Table of contents of the article:
Web caching is a vital tool for improving the performance of a website. It consists of a temporary memory in which the results of requests made by a web browser to the server are stored. In this way, when a browser requests a certain resource again, the server will not have to process the request again but will be able to return the result already present in the cache, thus improving site performance.
Let's take a look at what caching is and how it can help your website load faster now that we know why it's essential. You use your web browser to request and build a web page from the website server every time you visit it. The HTML element to create the page, images, content, style and other files are stored on the server. To generate a complete web page, your browser sends up to 100 requests back and forth from the website server.
If you don't use caching, you will have to make such requests repeatedly every time you visit that page. And everyone else who visits that website is making the same requests. When a large number of people access a website at the same time, the server slows down and becomes less responsive. Caching provides a solution by storing a copy of the completed web page in many places.
Whether hosted on a single local server or via a content delivery network (CDN), a cache maintains a copy of the files that make up a web page so that visitors can get to the pages more quickly.
One of the most popular software to implement the web cache is Varnish Cache, an Enterprise-level proxy server (used by the largest online companies in the world, as well as by us in Managed Server Srl) which is installed between the web server and the users' browser . Varnish is able to handle large quantities of requests simultaneously and to cache the responses received from the web server in disk or RAM, in order to speed up the loading of the site's pages.
If you don't have the skills or resources to use web caching software like Varnish, you can still improve the performance of your website by using outsourced services like Cloudflare.
Cloudflare is a Content Delivery Network (CDN) service provider that offers a wide range of tools to improve website speed and performance. Among these tools is the Web Cache, which works similar to Varnish's Web Cache, temporarily storing web page content to speed up delivery to customers.
Using Cloudflare as a Web Cache service has some benefits, such as eliminating the need to use and manage complex caching software like Varnish. In addition, Cloudflare offers a number of additional features such as DDoS protection, website acceleration by distributing content from worldwide distributed CDN servers, and content compression.
However, it should be noted that using outsourced services such as Cloudflare costs more than using caching software such as Varnish, and their impact on website management costs should be carefully evaluated.
Regardless of the solutions you intend to use, there is a problem that neither Varnish nor CloudFlare will be able to solve, let alone most of the Hosting providers out there (us included) that once the customer is onboarded, see you again for your Christmas wishes.
This post does not want to be only a criticism of the hosting market, intended with "the hostings that other providers provide", but also and above all a self-criticism, because in this respect we too have lazed around and have only been working for just a few months to change things and raise the bar of the hosting landscape (once again).
In fact, we find the highest and most complex cache layers in the major high-performance hosting providers, but then no one offers cache warm up service, suggesting that it is the customer's job to work towards the implementation of the same in order to have a higher Hit ratio.
What is the HIT Ratio of a Web Cache?
The cache hit ratio is a very important indicator that measures the percentage of customer requests that are served by the Web Cache. A high hit ratio means that a large percentage of the requests are served by the cache, which leads to a dramatic improvement in website performance.
To guarantee a high hit ratio, the cache must be "warmed up", i.e. it must cache the results starting from the sitemap. Furthermore, the customer must be used to working with the cache, for example for product import procedures, and must be aware of the presence of well-defined time slots in order to perform cache cleaning and purging operations which will be followed by the task in cron for its regeneration.
However, the use of the Web Cache can be useless if the website is not used properly according to some agreements with the end customer. If the website does not have high traffic or if the customer is not willing to update the website regularly, the Web Cache may not bring any significant benefit. In that case, implementing Web Cache could become an extra cost with no obvious benefit.
Train and instruct the customer to work profitably with the Web Cache.
Our company has decided to work closely with our clients to evaluate their modus operandi in managing their websites, especially ecommerce sites. In this process, we focus on the evaluation of product import operations, warehouse loading and unloading and all those activities that necessarily require a complete cache cleaning.
This evaluation process was initiated because we believe that effective cache management is critical to ensuring optimal website performance, especially on ecommerce sites.
Our company is aware of the importance of efficient website management, especially with regard to ecommerce sites. In collaboration with our customers, we have decided to evaluate their modus operandi in site management, in particular product import operations, warehouse loading and unloading and all operations that require a complete clearing of the cache.
Website caching is a crucial element in ensuring optimal performance and loading speed of the site. However, sometimes the cache can cause problems if not managed properly. In particular, the operations of importing products, loading and unloading warehouse can cause problems in the cache, as they modify the content of the website and the cache must be updated accordingly.
For this reason, we have decided to work with our most demanding customers to evaluate their product import practices and cache management modus operandi. In particular, we are investigating whether there are procedures in place to clean the cache on a regular basis and whether customers are aware of the need to do so on a regular basis.
We are also evaluating the possibility of defining precise time slots to perform cache cleaning operations and scheduling cron tasks for cache regeneration.
Freshcache.php a simple tool that can regenerate the web cache.
To warm up the web cache we have developed Freshcache.php, a tool used in our hosting service which, starting from a sitemap, is able to regenerate the cache. It can be launched both from the command line and via cron.
In the development phase we decided to focus on the usability and malleability of the tool which should have been able to be suitable and adaptable to any situation, CMS or platform starting from well-received standards such as sitemaps.
Mainly through curl we are able to generate parallel requests in order to regenerate the cache at specific times through cron or manually in moments when the customer deems it appropriate (for example after importing a new fashion collection) or having massively changed prices in view of the upcoming sales.
It is obvious and undisputed that the task must be expertly calibrated both in the client's standard workflow times which, once "instructed" will have to respect some simple rules and times to get the most out of its cache, furthermore it must necessarily be calibrated on the number of requests parallel to the in order not to saturate the server load from excessive CPU usage for executing non-performing PHP code or slow SQL queries.
Considering the advantages that are brought in terms of speed in a site that will always have an optimized version in the cache and also taking into account the impact that the regeneration of the cache can have in terms of load, for now we have reserved this feature for all customers who have a dedicated server or a dedicated instance in order to isolate load peaks from those that could instead take place in shared environments.