The success of a website (especially in e-commerce) depends on fast loading times of less than one second. This increases user experience and creates optimal conditions for conversion. A reverse proxy such as Varnish, which was developed as an HTTP accelerator, is an optimal help when it comes to performance on the web and the best way to counter a large number of visitors and the increasing complexity of your own website. The noticeably reduced loading time with Varnish also has a positive effect on search engine ranking.
Varnish HTTP Reverse Proxy
How Varnish Cache Works
To understand the advantage of Varnish, it is necessary to understand how traditional server configurations work without caching. If a web application like WordPress or Magento does not use Varnish, the web server (NGINX) answers all HTTP requests. Both WordPress and Magento are very PHP-heavy applications, which means that PHP-FPM and the MySQL database are included in every page request. After passing through this process chain, the client finally receives its response in the form of HTML from the web server.
As we can see, with a classic web server configuration many services are put into operation which do not have to be included in every request if the content of a page (e.g. the start page or a product description) does not change regularly. With Varnish things are handled differently: Varnish is set up as a reverse proxy directly in front of the web server (NGINX) and is assigned port 80 directly for receiving HTTP requests. When a page request occurs, it is first processed by the original web server (Varnish lets the request through if he doesn't keep a copy of it in RAM). However, Varnish stores the request and its contents in RAM. If an HTTP request is made to the same resource, the data can be loaded directly from the Varnish cache. More precisely, copies of the contents from the RAM are played back and it is no longer necessary to start the process chain of NGINX, PHP-FPM and MySQL for this HTTP request. This also saves computing time (less CPU consumption), which also has a positive effect on server performance.
Varnish uses its own script language for configuration: VCL (Varnish Configuration Language). VCL has a big advantage because it allows users to configure Varnish exactly the way they need it for the needs of their website or online shop. However, it should be noted that VCL makes the use of the cache a little more complicated, as the one who wants to use Varnish needs to be familiar with VCL and HTTP. Therefore, expert setup is useful to get the best result in terms of performance.
Performance Booster Varnish Cache
The use of Varnish as reverse proxy and HTTP accelerator significantly reduces the load on the web server. Programs such as PHP-FPM and the MySQL database no longer need to be considered with every HTTP request. This leads to a faster loading time and more satisfied customers. And as we know, satisfied customers lead to an increase in the conversion rate. We at Storepace have been working with Varnish for a long time and are therefore able to configure the cache so that it is optimally adapted to the needs of your website.