TCP Load Balancing in Jelastic
The process of application deployment is particularly simple, but growing a website can be hard. That’s why we decided to solve scalability and high availability (HA) problem instead of you to make application management easier then ever. As you know load balancing and clustering are part of HA strategy. Load balancing ensures high system availability through the distribution of workload across multiple components. Using multiple components with load balancing, instead of a single component, may increase reliability through redundancy. If one of the servers goes down, the other can still continue to function. At the same time clients see the group of servers as a single virtual server, with one IP address.
The main advantages for you:
- Better scaling: load balancing can be scaled across multiple servers in a cluster. Your application which are written to run on server clusters can perform dynamic load balancing.
- Easy and more flexible application managing, for example: you can update a server without impacting accessibility of data and services to your users.
- Fault tolerance: if a server fails, clustering software detects the failure and fails over to a remaining server.
Now Jelastic PaaS uses NGINX load balancer even for two types of load balancing: HTTP and TCP. You can use TCP for balancing requests to databases, mail servers and other distributable applications with network support. Also TCP can be used instead of HTTP if faster balancing is needed. In this case you just need to note that this fastness is achieved through omitting the process of handling requests.
TCP load balancing component receives a connection request from a client application through a network socket. This component decides which node in the environment receives the request. For this requests distribution Jelastic uses Round Robin Algorithm.
The existing connection can be lost only if a problem occurs, such as a temporary network failure or something like that. The next time a request is received, a new connection is created. This connection can go to any instance in the environment.
Note: this feature is available starting with Jelastic version 1.8.5.
To get TCP balancing at your Jelastic environment you have just follow the instruction below:
1. Create environment with two or more application servers (for example, Tomcat). In this case the NGINX will be added automatically. Note that you need to switch on Public IPv4 for your NGINX node.
2. Click Config for NGINX in your environment.
3. In the opened tab navigate to tcpmaps > mappings.xml and specify frontend and backend ports. Save the changes.
Frontend is a port to which a user is going to be connected.
Backend is a port to which the request will be forwarded by the balancer.
4. Restart NGINX node.
That’s all. Now your environment uses TCP balancing for your application servers.