Bobcares

Installing the LiteSpeed Load Balancer

by | Aug 23, 2010

We are constantly on the lookout for ways to improve the response times of our servers. We already have various software available in the market today that can help us achieve that goal, like Nginx, LightHttpd, Litespeed etc. In my article today we will discuss on one of them in particular – LiteSpeed, and its ability to act as a Load Balancer.

Litespeed can be used in 3 different ways. You can:

  • Install Litespeed Load Balancer and distribute the requests based on the server load
  • Install Litespeed to serve dynamic pages on one port and Apache to serve static pages on another.
  • Install Litespeed alone to serve all pages on port 80

All options are equally good. But now let me share with you, how I installed the LiteSpeed Load Balancer and certain issues I faced after that.

 

Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers

See how we do it!

 

 

LiteSpeed Load Balancer(LSLB) is a high-performance, content-aware, session-aware HTTP application load balancer. It can forward requests based on request content as well as session stickiness preference. LiteSpeed Load Balancer can help scale your application beyond one server deployment, as well as improve the reliability of your service in case of hardware failures.

Lets say we have 3 servers, I will be explaining with reference to a domain name mytestdomain.com. First and foremost, you need to make sure that the domain name is pointing to the IP of the load-balancer server. Hence, do make the required changes in the DNS for mytestdomain.com.

To install Litespeed Load Balancer in the server with IP address 1.1.1.1:

  • 1. Login to the server as root and disable port 80, as Litespeed Load balancer will be listening on port 80
  • 2. cd /root
  • 3. Download the load balance, based on your server version, from https://www.litespeedtech.com/litespeed-load-balancer-downloads.html
  • 4. tar -zxf /root/lslb-xx.tar.gx
  • 5. cd lslb-*
  • 6. Download the trial license from https://www.litespeedtech.com/trial/license/ and the trial key that is sent to your email account. Save it in /root/lslb-* folder
  • 7. ./install.sh
    You just need to accept the default values and continue with the installation. Just make sure that you enable port 80 for HTTP port.
  • 8. Enable the desired ports (80 for http and 7090 for admin interface) in the server firewall

We have now finished installing the Load Balancer.

 

As for the other servers in the group, for now, you can install Apache on them, but you could also move to lone instances of LiteSpeed on those servers too. Now lets start configuring the load balancer:

  • 1. Access the admin interface using the link https://1.1.1.1:7090 and the login credentials provided in Step 7
  • 2. Click on Configuration -> Virtual Hosts -> Add. You will see a Virtual Hosts Page
  • 3. Click Add
    Enter the Virtual Host Name : eg: mytestdomain.com
    Default Cluster : clusterHTTP
    Configure File : $SERVER_ROOT/conf/mytestdomain.com.xml
    Click SAVE
  • 4. You will see a message “Input error detected. Please resolve the error(s)”
    Click the link “CLICK TO CREATE
    Click SAVE
  • 5. Click SAVE, again, to finish. Now your Virtual Host has been added.
  • 6. Next click the link “Apply Changes”.

 

Now we need to configure clusters:

  • 7. Click on the Clusters tab.
  • 8. Click ClusteHTTP
  • 9. Click on the Worker Group tab
  • 10. Click on nodeHTTP/LI>
  • 11. Click Edit, to continue
  • 12. Enter the loadbalancer server address and the address of the servers that are being load-balanced. Please replace with your respective ip address:

    (mytestdomain) = node name
    1.1.1.1 = load balancer ip address
    1.1.1.2 and 1.1.1.3 = 2 web servers

 

This will make sure that if someone tries to access mytestdomain.com, the request will be reach the load balancer first and then will be routed to the server with the least load.

  • 13. Click SAVE
  • 14. Click on Listeners tab.
  • 15. Click View/Edit
  • 16. You need to click “Add” to add our virtual host mytestdomain.com, into Listener
  • 17. Click Add
  • 18. Choose your Virtual Host : eg: mytestdomain.com
    Input your Domains : mytestdomain.com, www.mytestdomain.com
  • 19. Click SAVE
  • 20. Click on “Apply Changes” in the message: “Configuration has been modified. To apply changes, perform Graceful restart Apply Changes
  • 21. Click Apply Changes / Graceful Restart

And thats it! You have now installed the LiteSpeed Load Balancer.

 

Here are a few issues I faced with the LiteSpeed Load Balancer:

  • If you see 503 messages in your browser, you need to increase “Initial Request Timeout (secs)” in clusterHTTP worker.
  • In case of DOS attack, you need to set “Connection Soft Limit” and “Connection Hard Limit” to block aggressive IP.
  • If you want to split the work load among the servers, you just need to assign different values for “Max connections” to the different serverslike “100” connections to server1, “50” connections to “server2”. LiteSpeed Load Balancer will use this as “weight” for different backend.

 

I hope this tutorial will help you achieve faster response times for your sites.


About the Author:

Remya Vipin has been with Bobcares for the last 6 years. She is an expert in cPanel-Linux servers and Linux server administration. She loves her work and aims to keep all her clients satisfied, but not as much as she loves spending time with her son.


0 Comments

Never again lose customers to poor
server speed! Let us help you.