How to Balance TCP Traffic
Last verified 22 Jun 2026
DigitalOcean fully manages Regional Load Balancers and Global Load Balancers, ensuring they are highly available load balancing services. Load balancers distribute traffic to groups of backend resources in specific regions or across different regions, which prevents the health of a service from depending on the health of a single server, cluster, or region.
Regional load balancers support TCP balancing for applications that do not speak HTTP. To set up TCP balancing, you need:
-
A TCP application, like a Galera cluster spanning several Droplets. The details of your backend configuration depend on what software you’re using.
-
A DigitalOcean Load Balancer with those Droplets added to its backend.
To configure the load balancer to balance TCP, you need to add a TCP forwarding rule and a TCP health check.
Add the TCP Forwarding Rule
From the Control Panel, click Networking in the main menu, then click Load Balancers. Click your load balancer’s name to open its Overview page.
On the Overview page, click the Settings tab.
Click Edit in the Forwarding Rules section. Modify the existing rule by clicking the … (More) menu on the rule row, then change the protocol from HTTP to TCP and update the port on the Load Balancer and Droplets sides from 80 to the listening port of your application. For example, when using a Galera cluster, use the MariaDB port 3306. When you’re done, click Save.
Add the TCP Health Check
On the same Settings tab, click Edit in the Health Checks section. An HTTP health check is defined by default.
Change Protocol type to TCP. In the Port field, change the value from 80 to the listening port of your application. Adjust Check interval, Response timeout, Unhealthy threshold, and Healthy threshold as needed.
Click Save to implement the change.