Tuning The Zeus Load Balancer For Optimal Performance
How to add tuning parameters
There are many many tuning parameters which can be used to configure the behaviour of the Zeus Load Balancer. The default settings should give high performance, but for optimal usage, or perhaps because special circumstances impose specific restrictions, you can configure each individual setting.The configuration file is in plaintext and is located at $ZEUSHOME/balancer/global.cfg. After making any alterations to this file, you must restart the load balancer for the changes to take effect. Ensure that you copy the modified global.cfg file to the other front-end balancer machine, then restart the balancer there as well.
Each configuration option must be placed on a new line in the file, in the format "tuning!<tuneable> <value>", e.g.
tuning!timeout 120 tuning!port_offset 0
tuning!port_offsetIf the Load Balancer receives a connection on port 80 (say), then it will try to contact a backend webserver on port 80 + port_offset, i.e. 10080. This enables the balancer and a backend webserver to co-exist on the same machine, should you wish this. The Zeus Webserver, when in clustering mode, expects this port offset to be in place. If you use other webservers, either adjust their configuration or change this value. 10000 tuning!timeoutDiscard any connection which receives no data from the client or server in this time period. 120 tuning!keepalive_timeoutClose any Keep-Alive connections between the balancer and clients that haven't been used for this length of time. 10 tuning!backend_timeoutThrow away any held Keep-Alive connections between the balancer and backend webservers that haven't been used for this length of time. 10 tuning!max_connect_timeTimeout period for apreempting to reach a backend webserver. This is accurate only to the nearest second (i.e. do not set this to 1 second, because some connections may get timed-out immediately) 3 tuning!max_connect_triesThe maximum number of backend webservers that we will re-send an individual request to, before the Load Balancer abandons the request. 5 tuning!mail_intervalThe minimum interval (in seconds) between sending out two warning emails / SMS messages. This is to prevent sysadmins being flooded with warning mails should the Load Balancer encounter problems. 900 tuning!ssl_cache_sizeThe maximum size of the SSL cache, which provides mappings from client IP addresses onto the last backend webserver that was contacted by this client. The cache is used as a hint to try and steer future requests by the same client back onto the same webserver. SSL connections to the same machine can be re-established much faster than to a completely new machine. If your cluster of web servers are running the Zeus Web Server, you can configure them to share their SSL session keys for further performance gains. 2048 tuning!ssl_send_ipIf set, the balancer prefixes all incoming SSL connections with an extra four bytes containing the IP address of the client connection. Without this information, backend webservers will log all SSL requests as if they originated from the balancer itself. This option will only work if you are using the Zeus Web Server (version 3.3.2 or later) for your cluster! If you are not doing so, you _must_ turn this feature off, else SSL connections will hang! yes tuning!client_buffer_size tuning!server_buffer_sizeThe size of the data buffers for each individual connection, client<->balancer and balancer<->server respectively.
Larger buffers will minimise the number of read() and write() system calls that the balancer must perform. However, it may also increase the amount of data that the balancer must re-arrange when it processes HTTP headers.
2048 8192 tuning!client_buffer_extWhen a client uploads data to a webserver, the Load Balancer can optionally increase the client buffers to accomodate some of the extra data, making the transfer more efficient. This tuneable sets the maximum amount of space (in bytes) that can be allocated.
2048 tuning!max_header_sizeThe maximum size of HTTP headers that the balancer allows per connection. The Load Balancer must read in all the headers of an HTTP request before streaming the rest of the data to a web server, so without a bound on memory usage, malicious or malformed HTTP requests could cause the Balancer to consume too much memory. 51200 tuning!keepaliveIf set, convert all connections between the balancer and clients to Keep-Alive, where possible. Some webservers close connections that they could hold open - in these cases, the balancer can still hold open the connection, even if the webserver closes it. yes tuning!keepalive_backendIf set, convert all connections between the balancer and backend servers to Keep-Alive, where possible. The final response to the client is unchanged. Keep-Alive connections between the balancer and backends are preferred, because they can be pooled and reused by future client connections. yes tuning!max_keepalivesThis is the maximum number of Keep-Alive connections to hold open, between the balancer and the backend servers. 250 tuning!use_chunkedIf set, the Load Balancer will process all 'chunked' connection encodings sent by backend webservers. Without this set, the balancer still supports the transfer of chunked requests, but won't be able to convert them to Keep-Alives, for instance. yes tuning!add_cluster_ipIn normal operation, the balancer adds to each HTTP requests the header 'X-Cluster-Client-Ip' before it is passed to a backend webserver. The header records the IP address of client machines who contact the balancer, enabling web server logs to record this information. This will work with all webservers (you will have to configure non-Zeus webservers to log this information, however). Turn this option off only if the Load Balancer is behind another proxy (e.g. another Load Balancer) yes tuning!read_zeus_backendIf this frontend balancer is directing traffic towards other frontends, then set this to 'no'. This will prevent the balancer from interpreting X-Zeus-Backend cookies, which can specify a particular backend server to service the HTTP request. yes tuning!read_on_connectIf activated, the Load Balancer will try to speculatively read data from a client as soon as it gets a connection, saving time. Depending on the configuration of your network and your machines, there may or may not be data available, so turning this option on may or may not speed up connections. no tuning!write_on_connectIf activated, the Load Balancer will try to speculatively write data to a backend webserve before it has confirmation that the connection has fully opened, saving time. Some operating systems will allow this, others will return errors, so it is disabled by default. no tuning!so_nagle_off tuning!socket_opt tuning!multiple_accept tuning!use_poll tuning!accept_mutex tuning!so_rbuff_size tuning!so_wbuff_size tuning!maxfds tuning!num_childrenThese tuning options are identical to those on the Zeus Web Server. See this page for details. yes yes yes yes no 0 0 16384 0