我计划创建一个软件负载均衡器,它将位于 linux 中的许多套接字服务器前面。客户端将连接到负载均衡器。负载均衡器将维护一个替代 ip 及其端口的表。它将客户端连接到最佳可用 ip 和端口并断开与客户端的连接。因此它将退出场景(将不再连接到客户端)。在这种情况下,只有连接的设备将是客户端和新的套接字服务器,但不是负载均衡器。
Example : Cleint ip 10.1.2.3 port 1234
load balancer Ip 10.1.2.4 port 1235
list of socket servers in Load Balancer:
A Ip 10.1.2.4 port 1236
B Ip 10.1.2.4 port 1237
C Ip 10.1.2.5 port 1238
Now
for the 1st request to the load balancer from client, the load balancer will establish a connection between the client & server A and disconnect itself from client.
for the 2nd request to the load balancer from client, the load balancer will establish a connection between the client & server B and disconnect itself from client.
for the 3rd request to the load balancer from client, the load balancer will establish a connection between the client & server C and disconnect itself from client.
Any Help on implementing this in Java is greatly appreciated.