Bobcares

Installing the LiteSpeed Load Balancer

PDF Header PDF Footer

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
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF