Experience OpenLiteSpeed

2023-09-21-login

Howdy! Today I will be tuning the underlying webserver that is running this WordPress application. My hope is to reduce overall CPU load as well as to get experience with more advanced settings. Hopefully I can teach you a thing as well.

HTTP Servers and History

Apache is the OG web server. Released in 1993; its daemon name within Linux is httpd. It serves HTML files over the HTTP protocol using port 80. To accomplish this, each connection spins up a thread on the CPU to grab and serve the content. As long as the connection remains active, so does the thread. This improves latency when loading additional pages. However if the underlying webserver is not well equiped for the load, these concurrent CPU threads can eventually overload the server.

The next big webserver is NGINX. Released in 2003 it was originally a proxy software that has evolved into a full fledged HTTP server. Instead of a process/thread heavy design, they created an event-driven method. This allows a single thread to remain open at all times serving HTTP requests. Once this thread cannot process anymore concurrent events, it will spin us another thread. This is considered horizontal scaling. This allows NGINX to serve more page visitors with fewer overall resources.

About OpenLiteSpeed

OpenLiteSpeed is an open-source project hosted on GitHub under the GPLv3 license. It is published by a group known as LiteSpeedTech. Their organization appears to offer this free and open-source product along with a few other complementary products such as CyberPanel and LiteSpeed Enterprise Webserver.

OpenLiteSpeed is a mixture of Apache and NGINX elements combined. It features an NGINX-like event driven architecture to keep CPU utilization down while also supporting Apache-style rewrite rules. This increases compatibility in a manner that I think is advantagous for newer system administrators.

2023-09-21-dashboard

I have linked an article that folks should read. It is well written and in-depth comparing Apache, NGINX, and OpenLiteSpeed. My takeaway from this blog post is that while OpenLiteSpeed is event-driven and very quick to respond to socket requests, it has a much heavier memory footprint than its nearest competitor.

Even with this caveat, my $5/month Nanode has been running OpenLiteSpeed webserver just fine for a year with satisfactory performance and resource utilization.

Web Server Tuning & Additional Setup

Navigating into Server Configuration; I went ahead and configured the following variables…

  • Server Name
  • Disable Geo Location Lookup
  • Certificate Administrator Email

2023-09-21-genServConfig

By declaring the Server Name here and within the /etc/hosts file, we can reduce INFO logs regarding mismatched hostnames. Next we want to disable Geo Location lookup. This will reduce CPU load during concurrent connections.

If you navigate over towards the App Server tab, you can configure and tweak the environment variables for underlying applications such as NodeJS, Ruby, and PythonWSGI. I went ahead and explicitly defined most the default values presented; except where they would exceed the resources I had available.

Additional Benefits of the One-Click Installer

While taking a deep dive into OpenLiteSpeed, I learned that PHP must communicate with the overhead webserver using a locally shared socket. LiteSpeed PHP is an API interface for the OpenLiteSpeed webserver and the PHP application. Using this API and some additional logic OpenLiteSpeed, LSPHP, LiteSpeedCache can perform cacheing, minifying, and other optimizations faster and smoother than typical “php-fpm” of “mod-php” deployments.

2024

Back to top ↑

2023

Mom Said Redefine Success

In High School I had one dream that stands out. Own a Porsche by the time I was 26. Looking back, I have no idea where this dream came from; because I was ra...

Back to top ↑

2022

Back to top ↑

2021

Back to top ↑