Web Server 7 : Balance your load, Use Reverse Proxy
By regi on May 18, 2006
A “Reverse Proxy” ??? How ??
a “Reverse Proxy”, a new integrated feature of Sun Java System
Web Server 7. You can download it FREE. You may want to know, what is a Reverse Proxy?, what
is the difference between a Reverse Proxy and Proxy? Reverse Proxy is
a proxy to the WebServer, it act as a WebServer. That means, even
though the content is served from the WebServer, person who
access the Reverse Proxy will think that, the Reverse Proxy is the
WebServer. In this way the actual WebServer is hidden from the user.
Whereas in Proxy, the request is just forwarded through the proxy, So
the actual WebServer is visible to the client.
Now let us talk about the load balancing feature of Reverse Proxy. What is a Load Balancer? To understand the answer to that question, let us consider a scenario. I have a web application which is used by millions of users. If I deploy this application on a single machine, then the load on that machine will be huge. Instead I will deploy this application on multiple machines (Cluster). Now I have to use some mechanism to share the load among these machines. Here comes the use of load balancing capability of Reverse Proxy into the picture. I configure my WebServer 7 as a Reverse Proxy to the above Cluster and provide Reverse Proxy's address to the users. So all the request will come to the Reverse Proxy, and it will route these requests to different machines in the cluster. There are three advantages.
The actual WebServer is hidden from the server
Load on each machine will be less
High availability of the application.
use WebServer 7 for setting up a Cluster.
WebServer 7 Cluster also
supports session fail-over. In
summary, WebServer 7 is a secured
clusterable web server with
embedded Reverse Proxy and Load Balancer.
consider an example. For simplicity I am not creating a Cluster,
instead am going to use two instances of different configurations
(Say config1, Config2) as Cluster and an instance of RP as load
balancer (Reverse Proxy). Also I am creating all the instances on the
same machine. You can use Admin CLI commands (wadm) or Admin GUI to
configure the above setup. The steps for creating such a setup is
Using Admin CLI (wadm)
Start Admin Server
Execute <Install Root>/admin-server/bin/startserv command
Start Admin CLI shell
Execute <Install Root>/bin/wadm --user <admin user> --port <admin ssl port>
You will get 'wadm' shell
wadm>create-config --http-port 8080 –-server-name config1 –-server-user root config1
wadm>create-config –-http-port 8081 –-server-name config2 –-server-user root config2
Deploy same web application on the above configs
wadm>add-webapp –-config config1 –-vs config1 –-uri /test <war file>
wadm>add-webapp –-config config2 –-vs config2 --uri /test <war file>
Create RP config
wadm>create-config –-http-port 8082 –-server-name RP –-server-user root RP
Create Reverse Proxy
wadm>create-reverse-proxy –-config RP -–vs RP –-uri-prefix / --server http://<hostname>:8080, http://<hostname>:8081
wadm>create-instance –-config config1 <hostname>
wadm>create-instance –-config config2 <hostname>
wadm>create-instance –-config RP <hostname>
wadm>start-instance –-config config1 <hostname>
wadm>start-instance –-config config2 <hostname>
wadm>start-instance –-config RP <hostname>
Also you can use the new improved Admin GUI to configure load balancer (Reverse proxy). Do explore ....
I will discuss about the session stickiness support later.