I have a group of servers (currently six of them) that each host some number of Java applications. There are around 100 total applications spread out among these servers. Each application only runs on one server at a time, and each application listens on a predefined port or set of ports. An application running on server1 today may be on server3 tomorrow but there is no way to predict which server it will be on. The whole setup is essentially a high availability scheme. The number of applications will increase as time goes on, as will the number of ports listened on and the number of servers in the group.
I’ve been tasked with load balancing this mess. Clients need to be able to send messages to a single VIP on a specific port and get their request delivered to the node that currently has an application listening on the specified port.
I have two ideas to make this work:
1) Send each request to each node. Only one node will ever accept the connection so the refused connections from the rest can be ignored. This actually creates an amplification attack upon each request so it is not optimal, but it may be acceptable if no better solutions exist.
2) An iRule that intercepts the request as it comes in, then performs a TCP connection on each node in succession until it finds one that accepts the connection on the port in question. Then it would assign that node to use for this and future requests for $port. This also creates an amplification attack but not necessarily on every request since future requests for $port would keep going to the same node. When a request is sent to a node that is no longer listening on $port, it should trigger a new “scan” to find the new listening node. The client applications are configured to retry some number of times so it’s ok if the request is sent once to a $node:$port that is no longer listening.
Example:
request1 comes in for port 9500
|
|- test node1:9500 (connection refused)
|
|- test node2:9500 (connection accepted)
|
|- assign node “node2” to the request
|
|- send request to node2:9500
|
`- node2:9500 accepts the request
request 2 comes in for port 9500
|
|- assign node “node2” to the request
|
|- send request to node2:9500
|
`- node2:9500 accepts the request
request 3 comes in for port 9500
|
|- assign node “node2” to the request
|
|- send request to node2:9500
|
|- node2:9500 refuses the connection
|
|- test node1:9500 (connection refused)
|
|- test node3:9500 (no need to test node2 again) (connection accepted)
|
|- assign node “node3” to the request
|
|- send request to node3:9500
|
`- node3:9500 accepts the request
Is my idea plausible or is there a better way?
Thanks for taking a look!
--
Kris Dames