Live Blog

Openlightspeed or Nginx? Which server reigns supreme!

Which webserver should be selected (Nginx or OpenLiteSpeed) and why?

Give Openlightspeed a rip, it’s worth it. Grab a drink and a biscuit, this is a long one.

I’m writing an article comparing Openlightspeed and Nginx from a technical standpoint. I love Nginx, I’ve built some pretty crazy setups and continue to use it daily. I can handcraft configs from memory, although that’s starting to change due to age :slight_smile:

As for the beta comment, OLS has a stable version of which is regularly updated, and major issues do seem to get attention especially since there is a lots of code shared across to LSE. There are quite a few code being used to power massive projects that haven’t been touched for years. If you’re worried about reliability and peace of mind, ask anyone running OLS at GridPane or Runcloud. I wish LSE was available on GridPane, especially since their free license would work for lots of smaller WooCommerce sites.

As for workloads and enterprise, it’s a mixed bag. Some projects get 5 users visiting a day, but can’t be down at all for any circumstance. Some projects get 100/requests a second and can be down during specific windows because there is no traffic at those times. I think for the majority, you’re not at an enterprise level or the production workload that OLS would become a concern. A server with 10 sites and low traffic is different than a server with a single site and an insane amount of traffic. I don’t hard line on one specific piece of software for everything, each use case is different.

There are just a couple of instances where OLS/LSE will go farther technically.

Litespeed has LSAPI which is a custom-built PHP integration moving PHP closer to the core of OLS/LSE. They say it’s faster than FastCGI which is from 1999, but solid and the fastest static caching solution out there. It’s just slower at PHP requests (can be debated).

Their caching system has a ton of features that make it technically superior to any Nginx caching system. This doesn’t mean it’s faster than Nginx, it just means you can control and cache more with OLS than in Nginx. Caching isn’t everything, it just hides badly written code which is what WordPress does best 😉 and we’re stuck with it for a while.

Litespeed has invested into their LSCache WordPress plugin to take full advantage of the Litespeed caching system, meaning you can do some crazy things. Private cache for individual users, desktop/mobile/currency/location caching. Lightspeed Enterprise comes with ESI (Edge Side Includes) allowing for specific blocks of a page to be uncached while the rest of the page is cached. They also support WooCommerce and cache some pretty specific scenarios.

There have been some pretty crazy claims about OLS/LSE, which has just ruined its reputation and it really pisses me off. I haven’t seen a comprehensive test that shows real-world usage when it comes to dynamic requests, specfically WooCommerce traffic (If anyone knows of one, please let me know! ). Nginx is a beast and will beat out Litespeed on raw requests all day, but once a user logs in or requests a dynamic request then there’s no more cache. OLS/LSE goes a step further and will cache more in these situations. I feel like OLS is now the Nginx back when everyone was using Apache, hating on Nginx.

Ultimately I’d love to see Nginx build out a better caching system that mimics that of OLS/LSE. The openresty Redis full page cache solution is almost there, but it’s key storage variables are limited, there is no tagging of cache keys and ultimately purging control is limited. This can be solved with Redis, but the performance is slower than holding the cache in the web server core. But a cache request is better than a PHP worker request as the latter is more expensive on resources.

It’s technically possible to completely mimic the Litespeed commands within openresty and make the LSCache plugin work with Nginx. But who’s going to do that? and why mimic when you can create something superior? Why not roll your own? The problem is no one has, F5 (Owns Nginx) has a paid cache module that is super expensive and doesn’t have all the options as OLS/LSE. The open source community has dabbled, they gave us Openresty, rTCamp gave us the Nginx Helper WordPress plugin.

If you’re doing 100/dynamic requests a second, hands down Nginx and lots of hardware. If you’re doing 10-40/dynamic requests a second, OLS/LSE all day with less hardware, but you’ll hit a ceiling where Nginx will just handle more requests.

Feel free to correct me on anything I’ve posted, no ones perfect and I strive to learn!