Thursday, June 18, 2015

Oracle Web cache as a load balancer



Oracle Web cache is a content management system. It works as a cache layer, as well as a load balancing layer for the underlying server. It is mainly used for load-balancing servers. Any website can be served by multiple origin server. Web cache balances the load among origin servers by determining the percentage of the available capacity, the weighted available capacity of each origin server.
The weighted available capacity is determined by the following formula:
(Capacity -Load)/Capacity
Where:
Capacity is the maximum number of concurrent connections that the origin server can accept.
Load is the number of connections currently in use.
If there are multiple origin servers and their available capacity is equal, the load balancing will be done based on round-robin algorithm.
To configure load balancing for a site, set the capacity of each origin server and create one site to server mapping that maps all the applicable origin servers to the site.
The diagram below represents a typical load-balancing pattern using Oracle Web cache. There are multiple host, which are hosting the application. The end user will pass the call to the Web cache which will redirect it to any of the host based on the routing algorithm defined for load balancing.



In order to achieve load balancing using Web cache, we will take two publicly available end-point URL. In this exercise, I will take oracle.com and ibm.com as the two end-point URLs. We will configure a front-end for the Web cache, which will be nothing but the front-end page for the client. We will configure this front-end page with the two end-point URLs we have defined. We will assign equal capacity to both the origin servers so that round-robin algorithm is followed, and we can call each of these end point on alternate calls. This is an example to depict the power of Web cache as a load balancer. However, in the actual context, Web cache is used for load balancing fusion applications, e.g., Service Oriented Architecture (SOA) server, OSB services, report server, etc.
Following are the steps that needs to be done in order to configure a load balancer. The assumption is that the Web cache set up is already done, please refer to the Appendix section for the installation details.
1. Access the Web cache page.
Login to the home page of Web cache using the following URL:
http://host:port
By default, the user will be ias_admin and password will be the one which you have used during installation.





Once you are logged in to Web cache you will get the following page.



Configure load balancing
Go to the following location.
(Windows) ORACLE_INSTANCE\\config\WebCache\\ webcache.xml
Locate the CACHE element at the last of the file.
Add the ROUTINGONLY=”YES” attribute to the CACHE element.





Save webcache.xml.
3. Restart Oracle Web Cache.
Use the following command:
opmnctl restartproc ias-component=component_name
This executable is found in the following directory:
(Windows) ORACLE_INSTANCE\bin




After restarting, if you will log in to the Web cache console, you will find that it is now configured for route only that appears at the top of the screen as shown below




Define Origin Server.
Go to the origin server and define two servers which you wanted to be load balanced.





Go to the site-to-server mapping and create a new mapping which will map the existing defined site to multiple origin server as shown below.




Submit and apply the changes and restart Web cache to take effect.







Validate configuration
Restart and now again check with the defined site and port.
In the first hit it, will redirect to the Oracle home page.

The second hit will redirect to the IBM home page.

As we have defined the capacity for both the servers to be equal, the load balancer is redirecting it in a round robin fashion.
In an ideal situation, all the managed servers in a cluster are defined in the origin server and they are load balanced by the Web cache layer


No comments: