Load Balancers¶
Overview¶

There are two load balancers in every node: Internal Load Balancer and Edge Load Balancer.
Internal Load Balancer works on port 8021, and it is used only for internal communication between applications. Communication with this Load Balancer should be closed with e.g. firewall.
Edge Load Balancer works on port 8020, and it is used for external communication.
Disabling/Enabling load balancers in application configuration¶
You can specify if given application should be available in each load balancer in application configuration.
serviceRepository:
healthCheckUrl: 'http://localhost:${application-instance-port-1}'
entities:
- entity:
priority: 1
port: ${application-instance-port-2}
protocol:
type: 'HTTP'
version: '1.1'
isExternal: true
isInternal: true
If isExternal property is set to true, application will be accessible in Edge Load Balancer, which means application will be exposed to external traffic.
If isInternal property is set to true, application will be accessible in Inner Load Balancer, which means application will be exposed to internal traffic.
Load balancer's service repository¶
To get external load balancer's service repository with the list of all the applications available on the given load balancer, access the http://<onm-ip>:8020/repository for edge balancer's repository and http://<onm-ip>:8021/repository for inner balancer's repository.
By default, Onteon Node Manager uses service repository, which is shared across all the node managers within the Onteon Control Center (it means that you can access application on node 1 using node 2 load balancers, if both are registered on the same control center). This can be changed in load balancer's configuration, so it uses the local service repository and access only the applications that are started on this node itself (this functionality can be useful, if node manager is not connected to any Onteon Control Center). To make these changes, make sure to modify the following files:
<onm-path>/app/nginx-edge/<appVersion>/<appId>/bin/lua-scripts/lua-onteon-node-manager-balancer/service_repository_manager.lua<onm-path>/app/nginx-inner/<appVersion>/<appId>/bin/lua-scripts/lua-onteon-node-manager-balancer/service_repository_manager.lua
In the above files replace line:
with:
Configure request sizes and timeouts¶
To modify request sizes and timeouts - edit the following files (where <onm-path> is by default /usr/local/bin/onteon-node-manager):
<onm-path>/app/nginx-edge/<appVersion>/<appId>/bin/conf/nginx.conf,<onm-path>/app/nginx-inner/<appVersion>/<appId>/bin/conf/nginx.conf.
It is important to make the configuration changes inside the application directory and NOT application instance directory.
After changing the configuration, make sure to restart node manager, so the changes are implemented.
Default configuration¶
client_body_buffer_size 8k;
client_header_buffer_size 1k;
client_max_body_size 10G;
large_client_header_buffers 4 8k;
client_body_timeout 30s;
client_header_timeout 30s;
send_timeout 30s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
Parameters¶
Header¶
client_header_buffer_size¶
Sets buffer size for reading request header. By default client_header_buffer_size 1k;.
large_client_header_buffers¶
Sets maximum number and size of buffers used for reading large client request header. If request exceeds this values it returns 414 (Request-URI Too Large) error. By default large_client_header_buffers 4 8k;.
client_header_timeout¶
Defines a timeout for reading client request header. If header is not transmitted in this time, status 408 (Request Time-out) is returned. By default client_header_timeout 30s;
Body¶
client_body_buffer_size¶
Sets buffer size for reading client request body. By default client_body_buffer_size 8k;.
client_max_body_size¶
Sets the maximum allowed size of the client request body. If the size in a request exceeds the value, the 413 (Request Entity Too Large) status is returned. By default client_max_body_size 10G;.
client_body_timeout¶
Defines a timeout for reading client request body. This timeout is set only for a period between two read operations, not for the transmittion of the whole request body. If not trasmitted in time, then status 408 (Request Time-out) is returned. By default client_body_timeout 30s;.
Other timeouts¶
send_timeout¶
Sets a timeout for transmitting a response to the client. The timeout is set only between two successive write operations, not for the transmission of the whole response. By default send_timeout 30s;.
proxy_send_timeout¶
Sets a timeout for transmitting a request to the porxied server. The timeout is set only between two successive write operations, not for the transmission of the whole request. By default proxy_send_timeout 60s;.
proxy_read_timeout¶
Defines a timeout for reading a response from the proxied server. The timeout is set only between two successive read operations, not for the transmission of the whole response. By default proxy_read_timeout 60s;.
Additional custom configuration¶
Additional custom configuration files to the edge and inner load balancers are available
in the <node-manager-path>/store/edge-balancer/additional.conf and <node-manager-path>/store/inner-balancer/additional.conf.
Each load balancer by default includes the corresponding configuration at the bottom of their nginx.conf files.
After adding custom configuration ensure to both test and reload balancer's configuration.
This can be done with test-configuration and reload commands defined for both nginx-edge and nginx-inner.
To execute these commands via Onteon CLI use the following commands: