Web Server 7 : Balance your load, Use Reverse Proxy

A “Reverse Proxy” ??? How ??

I mean 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.

  1. The actual WebServer is hidden from the server

  2. Load on each machine will be less

  3. High availability of the application.

Round robin algorithm is used for load balancing in WebServer 7. It supports session stickiness too.

You can 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.

Let us 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 given below.

Using Admin CLI (wadm)

  1. Start Admin Server
    Execute <Install Root>/admin-server/bin/startserv command

  2. Start Admin CLI shell
    Execute <Install Root>/bin/wadm --user <admin user> --port <admin ssl port>
    You will get 'wadm' shell

  1. Create Config1
    wadm>create-config --http-port 8080 –-server-name config1 –-server-user root config1

  1. Create Config2
    wadm>create-config –-http-port 8081 –-server-name config2 –-server-user root config2

  1. 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>

  1. Create RP config
    wadm>create-config –-http-port 8082 –-server-name RP –-server-user root RP

  1. Create Reverse Proxy
           wadm>create-reverse-proxy –-config RP -–vs RP –-uri-prefix / --server http://<hostname>:8080, http://<hostname>:8081

  1. Create Instances
           wadm>create-instance –-config config1 <hostname>
           wadm>create-instance –-config config2 <hostname>
           wadm>create-instance –-config RP <hostname>

  1. Start Instances
           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.


Hi. this is quite useful info. can you let me know about how can we distribute the load balancing between various clusters using reverse poxy? also, give me some tips on how to activate the third party balancers between app. server and proxy servers to increase the loading time... thanks for your help.

Posted by Rajinikanth on November 14, 2006 at 03:22 AM PST #

If your havin' trouble with your high school head He's givin' you the blues You wanna graduate but not in 'is bed Here's what you gotta do - Pick up the phone I'm here alone Call me any time 36 24 36 (slaver) I lead a life of crime Dirty Deeds Done Dirt Cheap

Posted by xzxczczx on December 02, 2006 at 05:54 AM PST #

hi great info. Ijust have one problem in create-reverse-proxy command if uri-prefix is "/xyz" then things dont work. i would like to have multiple urls pointing to different servers/applications. How do i do that? any thoughts?

Posted by Abhay dabholkar on June 18, 2007 at 01:27 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed



« February 2016