TCP Load Balancing

TCP Load Balancing

Load balancing improves system availability by distributing workload across multiple components. The platform uses NGINX for two load-balancing types: TCP and HTTP.

TCP Load Balancing Overview

TCP balancing can be used for databases, mail servers, and other distributable applications that support network connections. It can also be used instead of HTTP balancing when faster request distribution is required, because TCP balancing does not process the application-level request content.

Supported use casesDatabases, mail servers, and other network-enabled applications.
BalancerNGINX.
Distribution methodRound Robin Algorithm.
Connection behaviorOnce a connection is established, client requests continue through the same connection to the selected backend node.

How TCP Balancing Works

The TCP load-balancing component receives a connection request from a client application through a network socket. It selects one node in the environment using the Round Robin Algorithm and establishes the connection to that node.

After the connection is established, all requests from that client connection continue to the same selected node. The client application does not know which backend instance was chosen.

An existing connection is lost only when a problem occurs, such as a temporary network failure. When the client sends another request afterward, a new connection is created and can be assigned to any available instance in the environment.

Configure TCP Load Balancing

  1. Create an environment with two or more application servers, for example Tomcat.
  2. NGINX is added automatically for such a topology.
  3. Enable Public IP for the NGINX node.
TCP load balancing environment wizard
Create an environment with multiple application servers and enable a Public IP for NGINX.
  1. Click Config for the NGINX node.
NGINX Config button
Open the NGINX configuration-file manager.
  1. Navigate to tcpmaps > mappings.xml.
  2. Specify the required frontend and backend ports.
  3. Save the changes.
NGINX TCP mapping
Define the TCP frontend and backend ports in tcpmaps > mappings.xml.
  1. Restart the NGINX node.

Frontend and Backend Ports

FrontendThe port to which the user or client application connects.
BackendThe port to which the NGINX balancer forwards the connection request.
Public IP is required: the source workflow explicitly requires Public IP to be enabled for the NGINX node when configuring TCP load balancing.

Expected Result

After the NGINX node restarts, the environment uses TCP load balancing for the configured application servers. New client connections are distributed through NGINX using the Round Robin Algorithm, and each established connection remains bound to its selected backend until the connection ends or is lost.

Important Notes

  • The platform supports both TCP and HTTP load balancing through NGINX.
  • TCP load balancing is suitable for databases, mail servers, and other network-enabled applications.
  • TCP balancing can be faster than HTTP balancing because it omits application-level request handling.
  • TCP connections are distributed using the Round Robin Algorithm.
  • After a backend is selected, the existing client connection continues to use that same backend.
  • Configure TCP port mappings in tcpmaps > mappings.xml.
  • Restart NGINX after saving the port mappings.