Litespeed Cache ( LSCACHE ) Details and Advantages

Posted on December 23rd, 2016

Litespeed cache

Have you ever heard about Litespeed cache? As the name indicates, the Litespeed cache is a cache and it is used in the Litespeed Web Server. In this documentation, we are going to see the Litespeed cache in detail. Before looking into the Litespeed cache, we are now going to see the Litespeed web server.


The Litespeed Web Server

The Litespeed web server is an alternate to the traditional Apache Web Server. It appears identical to the Apache, but with unbelievable performance improvement. In fact, the Litespeed Web Server (LSWS) is a high-performance Apache drop-in replacement. The Litespeed Web Server is the number 1 commercial web server on the Internet.


Features of LSWS

There are many features with the LSWS. The common and important features of LSWS are listed below.
Apache Compatibility: The LSWS is apache compatible. It is compatible with commonly used apache modules like mod_rewrite mod_security, etc. The .htaccess os supported in the LSWS.

Increased Performance: The LSWS gives more performance compared to the Apache. The secret behind the increased performance is it’s event-driven architecture. The LSWS can respond to thousands of requests at a time with a low memory usage.

More Secure: The LSWS is more secure than the Apache web server. As we’ve seen earlier, it is compatible with the mod_security.

With these features, the LSWS is powering the shared servers worldwide. InterServer is using the LSWS as the web server for shared hosting.


Litespeed Cache (LSCache)

There are 3 different editions for the Litespeed web server. They are OpenLiteSpeed, LSWS Standard and the LSWS Enterprise. The Enterprise Edition comes with a built-in cache functionality called LiteSpeed Cache or LSCache. It is bundled with 2-CPU+ licenses for free and as an add on for other licenses. It is available since version 4.0. The LSCache behaves similar to the mod_cache in Apache. It works similar to Varnish. The usage of LSCache is not limited to PHP pages and caches the dynamic contents. The inevitable peculiarity of the LSCache is that it uses rewrite rules for better flexibility. This rewrite rules are implemented either in configuration files or in .htaccess files of each website. As the cache mechanism is built into the LiteSpeed web server, it eliminates the need or one layer of a reverse proxy resulting in increased performance.


How to Enable LiteSpeed Cache?

The LSCache can be enabled in different ways. There are plugins to use to enable the cache, if you are using WordPress, WooCommerce, Magento and Xenforo. You can enable the cache with the plugins. Please follow the below link to enable the LSCache in this way.

If you are using customized codes in your website, you should not follow the above link, but you need to follow the following guidelines. Please follow this only if there is no LiteSpeed Cache plugin available for your application. This is a non-application specific guide. You can enable the LSCache with the rewrite rules. It works as below. It will design an signature token like a cookie. This cookie will tell the LSWS that the cache can be enabled and Time To Live (TTL). While caching the pages, please get assistance from a developer if you need to. This is because abuse of  caching will degrade the performance. Generating cookies will modify the code and you should find out if the cache enabling pages are worth caching.


Public Cache and Private Cache

The LSCache has added a special feature called private cache support. Let’s see what is Public Cache and Private Cache.


The Public Cache

The Public Cache is intended to be used by multiple clients where the private cache is used by one client. The Public Cache provides more performance and room for growth.

With Public Cache a client can receive the cached version of website without the need of having the original version at least once. Majority of proxies, including Reverse Proxies, are using Public Caches. The Public Cache is also called the Shared Cache.

The Public Cache is recommended for use when the data is on a demand by many of the clients. It is wise to use the caching for the contents that may not change frequently.


The Private Cache

The Private Cache is intended to be used by specific individuals. This is applied only to the cache maintained by that client. Suppose you have a Local Area Network. You use it for your own use and you put a web proxy near the gateway. You can configure it as a Private Cache. Please note that the Private Caches has less room for growth when compared to the Public Caches.

Private cache is intended for one client only. It is applicable when you store personal data and you need to provide it only for authorized users. It is a good idea to use Private Cache when content is provided with SSL over the HTTPS protocol. The Private Cache is ideal with the web responses utilizing a cookie. Even though the Private Cache is less compatible, it has many advantages over the Public Cache.


Private Cache-Advantages

Almost every client and the machine-only parts of the web use a Private Cache. It is possible for you to rely upon the presence of at least one cache for anything that you do on the web.

It may not possible for Shared Caches to cache some representations. It may not possible also to return them without proper re-validation. That  problem doesn’t exist with the Private Cache.

We’ve seen the advantages of Private Cache. Keep in mind that there are many conditions where you should not use the cache. You should not use either Public or Private Cache with the contents that are changed frequently. It is wise not to use the cache with the time sensitive information (Dynamic Contents). You should not use the caching for POST requests.


If you need any further assistance please contact our support department.



Leave a Reply