As you can see requests are initially directed to an IP sprayer. The requests are then forwarded to the layer of Web Server, where the WebSphere Plug-in evaluates each request to figure out whether the request should be forwarded to the application server layer by matching the incoming request URL with the URLs defined in plugin-cfg.xml to check if there is a match if yes forward request to the application server.
The Plugin can be configured to use either of two load balancing algorithams for routing request
- Round robin: The Round Robin is the default load balancing algorithm, in this case when the first request arrives the server is selected on random basis but thereafter the requests are forwarded on round robin basis.This implementation ensures that in multiple process based Web servers, all of the processes don't start up by sending the first request to the same Application Server.
- Random:In case of Random load balancing the requests would be forwarded to the application servers on random basis
Important Note: Every time a web server receives a client request it checks if this is a new request or old request by checking for either session cookie or session url.If it finds a session it will forward request to the same application server which was used to handle previous request for the client. This is called session affinity
If you want you can change the load balancing algorithm from the WAS console by going to Server -> Web Servers -> Plug-in properties -> Request routing and changing value of Load balancing option
As you can see the load balancing in case of ND environment is pretty basic and it has following disadvantages
- There is no communication path back from the application server machines to the Web server plug-in. As a result, the plug-in does not know how busy a server is; often, the plug-ins first indication that a server is overloaded is when the server stops responding to the requests
- The information used by the plug-in to determine how to route requests to application server is static. That is the mapping between requests URLs and set of application servers that can service those URLs is provided by an XML file that is generated by the deployment manager and must be manually copied by the administrator to the web server machines. When the URLs change or when a new serveris added the plug-in file must be regenerated and replaced.