Central Director, Java Based Load balancer

SourceForge Logo

  Introduction

I started this as a light weight project for myself but pretty soon it grew into a full fledge application with a scope for future enchancements. I have tried to model this load balancer with an eye towards the functionality available in Linux virtual Server. The fact that it is done in Java makes it platform independent. At the same time, it restricts the APIs available to you at the raw network layer. The performance of a Java based load balancer may never match that of a well written load balancer in C/C++, but as teh platform is evolves further, it can only get better. With the ever increasing number of Java based enterprise apps, I wanted something that can intergrate well with the cross platform nature of java, and still provide decent load balancing. Hence the birth of Central Director, the Java based load balancer.

  Access to Binaries & Sources
  Project details

It is designed to be very straight forward to install and run. For windows the whole package comes with a self installing package and for Unices (Unix and Linux) you can download the tar ball and run the start script to start the Central Director. From that point on, you can point a web browser to its admin server and configure it with a few mouse clicks.

The following protocols ares supported right now:

  • HTTP
  • HTTPS
  • TELNET
  • FTP
  • SMTP

More protocols will be added on an ongoing basis. If you find that you need something and it is not in the current code base, and I promise to add it in. Send an email to Uday Singh.

  Minimum requirements

 

  • Windows XP/2000/98 or Linux or Any flavor of Unix (Solaris, AIX, HP-UX)
  • JRE 1.1 or higher.
  • Keep in mind that the more powerful the machine on which Central Director is loaded, better the load balancing impact for you cluster of servers.
  • On Linxu/Unix, you need to be root to be able to configure central director to load balance on privileged ports (<1024).
  Installation instructions

For Windows:

  • Download the installation package from Project summary page
  • Double click on the downloaded executable (central_director.exe) or Run it from the Start menu.
  • It will walk through the install process to install the Java Central Director.
  • It does try to detect the existence of JRE on the windows system. But if there is any trouble, make sure that java is available in the PATH.
  • Once the install is complete, you should see a 'Director' menu added to you windows Start menu. If you had chosen not to add a menu item to your Start menu, you can start the director by invoking run.bat script in the main installed directory.

For Linux/Unix:

  • Download the gzipped package for Linux/Solaris from Project summary page.
  • Change to a directory location where you want to install Central Director.
  • gunzip the central_director.tar.gz.
  • tar xvf central_director.tar.
  • That should extract all the relevant files into the directory and also create sub directories under it.
  • Make sure that java is available in the PATH.
  • In the installed directory you should see a run.sh script.
  • Run the script.
  Running the Central Director

Once you have the run.bat or run.sh running:

  • By now, the Central Director is up and running.
  • You can access the admin GUI by pointing to http://localhost:2001, if your web browser is running on the same machine as the Central Director.
  • The initial username is: admin and password is: admin
  • Once you login, you are ready to configure the Central Director to start load balancing on one or multiple ports.
  Configuring the Central Director

 

  • As soon as you log into the admin GUI through the web browser, you should see a provision to Add Port. Click on it to chose a port on which your clients will be listening. For example, port 80 in the case of HTTP.
  • Define a protocol that you are planning to support at that port.
  • Click Save.
  • It will take you to the next screen where you can add Real Servers across which you want to balance the load.
  • Following are options of interest that need to be set properly that help in detecting real servers that are down and maintaining session stickiness.

Stickiness Time

This property is set in millisecs. If all your real servers are stateless and you do not care for subsequent requests from a client to go back to the same real server, then you can set the value for this property to 0. What this basically does is that, each new request from any given client is forwarded off to the next free real server.

But if you have an application for example, shopping cart, then you would want the clients request always to go back to the same server. Depending on how long you want to maintain that shopping cart, you can set the time to that number. If you want to shopping cart to go away, say after 30 mins of inactiviy from the user, then set this to 1800000 (30 mins). This ensures, once the client has established a shopping cart with one real server, then within the next 30 mins, if he comes back with any request, he will directed to the server on which his shopping cart exists, no matter what the load. Each time he makes a request, the timer is reset. So his session will only timeout, if he has been inactive for 30 mins.

Ping Time

This property is set in millisecs. The two important features of Central Director are Load Balancing and Failover. So it needs to monitor the health of real servers, to keep the information upto date, so client requests can be properly routed. This ping time is the time between subsequent pings. A good number is between 10 secs and 1 min (that is 10000 to 60000). You dont want it too low, as it comes with a cost. And you dont want it too high, then we will not be able to detect servers that are down for a min.

Real Server Weight

The only load balancing algorithm supported in the current release is the weighted round robin. So you can assign weights to each of your real servers. If all servers are equal (in terms of processing power) then give each of them a weight of 1. But if you think one of them is better/powerful than the other, then give it a weight of 2 or higher. That way it will receive more requests than the others, in essence taking advantage of its higher processing power.

  
If you want to promote similar innovation and creativity, read up more at