Are you trying to enable LiteMage cache warm up on your Magento website?
One of the sure-shot ways to speed up the Magento pages is to activate the LiteMage cache.
Further, when the cache is warm and fresh, the webserver can serve requests even faster.
At Bobcares, we help customers in Magento configuration as part of our Server Management Services.
Today, we’ll see how we setup LiteMage cache warm up on the Magento website.
A word about LiteMage cache
Let’s begin by checking more on the LiteMage cache.
In simple words, caching is storing the data in server memory for quick retrieval. Likewise, LiteMage cache is specifically designed for Magento full page cache. It can cache both static and dynamic pages and improve the Magento website performance. It holds a directory that contains the cached content.
To enable LiteMage cache, users have to install the LiteMage extension for Magento. It helps to control and configure the cache within Magento.
How does a warm cache help?
Now that we know about LiteMage cache, let’s check how a warm cache helps.
A warm cache is nothing but freshly stored data of your Magento website. To retain the cache, there exists a crawler that refreshes the pages before they expire. As a result, when a visitor requests a page, they need not connect to the Magento backend. Thus the page loads faster with a warm cache.
How we enabled LiteMage cache warm up
Recently, a customer came to us with a request. He had enabled LiteMage cache on his Magento website. But the sublinks on the website were not showing LiteMage cache hits.
The customer wanted to enable cache warm as there were thousands of pages and they didn’t want to miss LiteMage cache hits. Let’s see how we did it for the customer.
Enable the crawler script
As the first step, we downloaded the crawler script from https://www.litespeedtech.com/packages/litemage2.0/M2-crawler.sh. Then we made the crawler executable.
Finally, our Support Engineers ran the crawler script. The results appeared as:
[root@server ~]# sh /root/M2-crawler.sh -v -d https://www.xxx.com https://www.xxx.com -> -------Debug curl start------- URL: https://www.xxx.com AGENTDESKTOP: User-Agent: lscache_runner COOKIE: HTTP/1.1 201 Created Connection: Keep-Alive Content-Length: 0 Date: Sat, 02 May 2020 00:27:34 GMT Server: LiteSpeed -------Debug curl end------- Header Match: HTTP/1.1 201 Created Already cached
Further, we recreated the sitemap and configured the cron job to run with the crawler script. Then we also added the cronjob to evoke LiteMage cache warm.
In higher versions of LiteMage plans, there are options to cache warm from the admin dashboard of the Magento website.
Now comes the question of whether the cache directory needs any sort of maintenance? Will it grow and create disk problems?
Fortunately, on a LiteSpeed server using LSCache, there is an automated way of taking care of the cache directory. It uses a Cache Manager SHM that stores information about the cache objects. It also has an option to specify the TTL (time to live) that decides the expiry of the cache entry. Together with the Least Recently Used cache replacement and TTL value, LiteSpeed automatically deletes specific cache files on the disk.
In other words, to avoid heavy disk operation, it does not empty the entire cache directory on the disk.
However, to remove the cache manually, we suggest using the cleanliteimage script from LiteSpeed.
/usr/src/lsws/lsws-5.4.6/admin/misc/cleanlitemage.sh -priv <age_mins> -pub <age_mins> <litemage_cache_dir1>
Here, we specify the maximum age of items stored in the private cache, cache directory, and public cache age as 0. Thus, the public cache will not be purged.
[Do you need help in configuring the Magento website? We are available 24×7.]
To sum up, enabling LiteMage cache warm up helps to improve the performance of the Magento website. Today, we saw how our Support Engineers tweaked cache settings on a live Magento website.