Websites, at LiteSpeed.

Written by Jo Stonehouse
We recently announced the addition of Redis and Memcached to our Business Hosting Plans, two of the most widely used solutions to accelerate database queries through caching.

Today, we're introducing another speed enhancing tool - LiteSpeed Cache.

LiteSpeed Cache can dramatically increase the speed of your website. This can have significant impact on your search engine ranking and also improve your user experience and the number of prospective customers your business converts.

Once implemented, your site will operate, quite literally, at light speed.

The performance is simply breathtaking.

What is LiteSpeed cache?

LiteSpeed Cache is a server-side page caching tool. To understand just what this is, we will first need to explain what caching is and why it increases speed at all. Next we'll examine what 'server-side' page caching means, and why this is significantly faster than application-level caching solutions.

What is Page Caching?

To understand what page caching is, it may be easiest if we deal with an example of a site that's built with the WordPress content management system. The same general principal applies to any content management system, however.

When WordPress is first installed, it ought to run pretty fast. Nobody uses a vanilla WordPress, however. Usually you will use a custom theme, and you'll also add a number of plugins. Your site now looks great, and thanks to the various plugins, it has all the functionality you need. However, as a result of all these extras, the site will inevitably load a little slower.

Why does this happen?

It happens in part because every time someone loads a page, all of the PHP code in your theme and active plugins has to run, in order to create the final output of the page. If you have lots of plugins, or a theme or plugin that's poorly coded, this can cause a significant overhead and result in a really slow site.

The idea of caching is that rather than do all of that heavy lifting each and every time a page loads and for each and every visitor, we only do it once when the page is accessed for the first time. We then store the output of the code, and the next time someone visits the page rather than rebuild the entire page dynamically, we just output the that stored HTML code instead.

This makes things much faster, but there is one major issue that has to be dealt with: what happens when content changes?

If we're caching content, we need to know when content changes. For instance if you change some text on a page, or product pricing, you need to be sure that when visitors land on that page they get the updated content rather than whatever was previously cached.

To ensure this happens, the cached copy of the page needs to be 'evicted' from the cache when content changes. Once the specific cached content is evicted, the next time someone accesses that page, it will be dynamically generated again, and then the new updated HTML output will be stored in the cache ready for the next visitor.

To handle all of this, applications like WordPress have numerous plugins available which create the cached content, and which evict any specific content when someone edits it via the WordPress admin area.

What is 'server-side' page caching?

You should now have a good understanding of the general concept of a page cache. If you're a WordPress user, you may have even used one or the numerous caching plugin solutions out there, but until now these will most likely have all been application level caches. We reviewed two of the best of these in a previous post.

In most cases, if someone hits a WordPress site with a caching plugin implemented, PHP still has to execute. The code that tells the user to load the cached HTML is coded in PHP within the caching plugin. It is therefore necessary for the WordPress 'core' PHP code to execute, and the PHP code of the caching plugin to execute and load the HTML from the cache. You've therefore saved a lot of the overhead as you don't have to execute the code of all of the plugins you have installed, but you are still nonetheless still executing some PHP code.

With server-side page caching, no PHP needs be executed at all. When a request for a page comes in on an environment with server side page caching, if cached content exists, it is passed to the visitor directly without even invoking WordPress or a PHP execution whatsoever.

But what about cache eviction? How does the web server know that it's content is up-to-date?

In the same way that an application level cache needs to evict pages from the cache when that content changes, so does server side page caching. For this to work, we need to install a plugin or extension in the application itself which knows how to properly evict the relevant cached content from the server side page cache. As with application page caches, the LiteSpeed server-side page cache can be cleared using a simple plugin, either one that's been designed specifically to work with LiteSpeed, or one that's been more generically designed to work with a server-side page cache (such as Varnish). That's because LiteSpeed has been designed to work exactly like other server side page caches, and can either have it's cache purged on receipt of HTTP purge requests, or more simply by deleting files in a hidden cache folder in your user account.

For WordPress, caching is just the beginning.

WordPress is by far the most popular CMS on the Internet today, powering in excess of 20% of websites. It's no wonder then that LiteSpeed have spent an enormous amount of time developing the caching integration with WordPress.

The integration with WordPress is, quite simply, breathtaking.

They've gone far beyond the essential functions of caching pages and working out cache eviction, and have also integrated a myriad of other in-app optimisation features, all designed to turbo charge WordPress websites.

Every conceivable feature you would want in an optimisation solution is there - merging CSS and Javascript, minifying code, lazy loading images, leveraging HTTP/2 Server Push support, deferring javascript, optimising images and much more besides.

Once configured, your WordPress site will not only be fast due to the caching, but super optimised in terms of it's internal code, supercharging site speeds and helping you achieve leading PageSpeed scores and boosting your SEO.

How fast are we talking?

Seriously fast. In almost every case, sub-second response times are easily achievable with just the basic caching. With the WordPress plugin and more extensive fine tuning using the options it presents, it's possible to load even fairly large sites in under 500ms.

It's worth noting that LiteSpeed Cache works great in conjunction with our Redis or Memcached service, and can also be used alongside CloudFlare, allowing you to accelerate site speeds internationally.

This sounds great, how can I get started?

LiteSpeed Cache is available as standard on all of our Business Hosting Plans. It can also be enabled as a paid addon to our Solo and Startup plans.

If you're an existing Kualo customer with a plan that supports LiteSpeed Cache already, just click the LiteSpeed icon in cPanel to enable it.

If you're not on a compatible plan or are on a plan which requires the LiteSpeed addon, please get in touch by raising a sales query on our helpdesk, and we'll be happy to outline what's involved and also offer you a 7 day free trial if you'd like.

Don't miss out!

Get our updates on web development, online marketing, customer support and (of course) web hosting!

About Kualo: Jo

About the Author

Jo Stonehouse is the Founder and Managing Director at Kualo. He loves helping businesses succeed online, and is based in London were he lives with his wife, Sali, and dog, Milo.