Pramati LoadBalancer Best Practices

While setting up Pramati Load Balancer, we must configure it properly so that the basic purpose of balancing the load will be served. This requires two files to be configured properly, those are:

1) web-lbconfig.xml file located at <PramatiServer_Home>/server/nodes/<ld_node_name>/config directory
2) web-config.xml file of each back-end node.

Provided below with the few things to be taken care:

1) “web-lbconfig.xml” file

- Provide the required node name and port name in the <nodes> tag. The node name has to be unique and not necessarily the actual name of the node.

Eg:

<nodes self-name=”null”>
<node name=”node1″ host=”192.168.1.1″ web-port=”8383″>
<naming-port>9393</naming-port>
<socket-pool enabled=”true” min=”20″ max=”50″ pool-idle-timeout-seconds=”100″ />
</node>
</nodes>

- Under the “<node-choosers>” tag, please search and remove the comment from the tag “<host>” and provide the following details:

– name of the host
– uri pattern for the application
– reference node name

Eg:

<host name=”localhost”>
<uri pattern=”.*jspDeskWeb(.*)?” node-ref=”node1″/>
</host>

- The pool-idle-time-out-seconds should be set to less than than the min of keep-alive-timeout, idle-time-out of back-end nodes. Let us assume that, if the pool-idle-time-out value is x Secs, the keep-alive-timeout for the back-end node could be set with following equation:

(x+20)*1000 milli seconds.

Configuring this will ensure that the socket connections between the Loadbalancer and the back-end nodes will not get timed out for a long period of time. There will not be any unnecessary socket creation.

- If more than one back-end nodes are to be configured then provide all the nodes’ name in a comma separated list in the following manner:

Eg:

<host name=”@”>
<uri pattern=”.*jspDeskWeb(.*)?” node-ref=”webnode1,webnode2,webnode3,webnode4″/>
</host>

- Define the fail-over nodes if you are having more than one back-end node. Change the <failover-node-choosers> tag as shown below:

Eg:

<failover-node-choosers>
<node-chooser name=”generic-fail-over-node-chooser” enabled=”true”>
<failover failed-node-ref=”node1″ standby-node-ref=”node2,node3,node4″/>
<failover failed-node-ref=”node2″ standby-node-ref=”node3,node4,node1″/>
<failover failed-node-ref=”node3″ standby-node-ref=”node4,node2,node1″/>
<failover failed-node-ref=”node4″ standby-node-ref=”node1,node2,node3″/>
</node-chooser>
</failover-node-choosers>

- In case you have configured multiple back-end nodes, then the maximum socket pool size of each node configured in web-lbconfig.xml must be equal or less than the keep-alive thread count of each back-end node (as mentioned in the web-config.xml).

- Further, the total worker thread count on LB node must be equal with the total number of threads of all the back-end nodes. Something like below:

Eg:

If, in the “LB” node’s web-lbconfig.xml, we have two nodes, such as:

<nodes self-name=”null”>
<node name=”webnode1″ host=”localhost” web-port=”18793″>
<naming-port>9393</naming-port>
<socket-pool enabled=”true” min=”20″ max=”50″ pool-idle-timeout-seconds=”100″ />
</node>
<node name=”webnode2″ host=”localhost” web-port=”18793″>
<naming-port>9393</naming-port>
<socket-pool enabled=”true” min=”20″ max=”50″ pool-idle-timeout-seconds=”100″ />
</node>
</nodes>

then, the appropriate numbers of LB worker thread count and back-end node count would be:

In web-config.xml of LB node

<worker-thread-count max-active=”-1″ max-keepAlive=”100″>125</worker-thread-count>

In web-config.xml of nodes “webnode1″ & “webnode2″ (each)

<worker-thread-count max-active=”-1″ max-keepAlive=”50″>75</worker-thread-count>

Now with these tunings LoadBalancer is ready to serve request. Let us tune the back-end nodes as well. So the file to be tweaked is “web-config.xml” of each back-end node.

2) “web-config.xml” file

- Change the value of keep-alive-timeout (millis) to a high value. Preferably to 2-3 minutes. This value decides a request can  wait for 2-3minutes on a socket.

- Disable the Denial Of Service on all the back-end nodes by setting the <denial-of-service> tag value to false

Eg:

<denial-of-service enabled=”false”>

- The <worker-thread-count> count value must be greater than the “<max-keepAlive>” value. The <worker-thread-count> count is the number of threads that process requests.

- The “max-keepAlive” attribute is the most number of worker threads that can be in a keep-alive wait state. Setting the value lesser than that of  worker-thread-count allows for some threads to be always free to serve newer connections.

With these, the whole setup is tunned well to serve the load.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)