Tuxedo负载均衡是如何工作的?
In order to describe the TUXEDO load balancing, two configuration modes need to be distinguished, the single machine (or SHM) mode and the multiple machines (or MP) mode. Moreover within each mode, we need to distinguish the cases when the LDBAL *RESOURCES parameter is set to Y and when it is set to N. Indeed these two major parameters, and some others (NETLOAD from *MACHINES, PRIO from *SERVICES), dictates the TUXEDO load balancing algorithm behavior. The load balancing does not make discrimination on the type of server, a /Domain gateway is considered as a server advertising the remote services specified in the *DM_REMOTE_SERVICES section in the dmconfig file.
Load Balancing in SHM mode
-----------------------------------------------
In SHM mode only one machine is part of the application. All the application servers are located on that machine.
If the LDBAL *RESOURCES section parameter is set to N then all the same service requests will be sent to the same first server advertising the requested service.
If the LDBAL *RESOURCES section parameter is set to Y then TUXEDO is maintaining real time statistics on the amount of work currently in the queue of a single server or in the queue of multiple servers. That amount of work in a queue is the sum of the load of each service request currently in that particular queue. Each time a server processes a service request, its corresponding amount of work in its queue is decreased for the service request load. The server choice is done when a service request is being issued.
At that time TUXEDO checks for any IDLE server advertising the requested service and will send the service request to the first one found. If there is none then TUXEDO, according to the service request load, internally computes the new load of each server (in the MSSQ case, the current load per server is the current load in the queue divided
by the number of servers on that particular queue) and chooses the less loaded one. This is the "real-time" TUXEDO load balancing algorithm.
Load Balancing in MP mode
--------------------------------------------
In MP mode, the application is composed of multiple machines. Each machines may run server processes advertising the same services.
If the LDBAL *RESOURCES section parameter is set to N, the behavior is the same as in SHM mode. Even if the chosen server is a remote one.
If the LDBAL *RESOURCES section parameter is set to Y then TUXEDO is maintaining cumulative statistics on the amount of work sent to each server. These loads are never decreased, as opposed to the "real-time" load balancing algorithm, but are periodically reset. When a service request is issued, TUXEDO checks for any IDLE local server and, if one exists, will send the service request to it. If there is none, TUXEDO internally adds the service request load to the cumulative load of each server, eventually, for each remote server, adds the NETLOAD value of the machine where the server is located, and then chooses the less loaded server. This is the "round-robin" TUXEDO load balancing algorithm.