As you should know, the loading time of your site is essential to ensure a good experience for visitors, better conversions in the case of an e-commerce site and even better natural SEO!
We therefore propose that we consider today the Nginx FastCGI cache module which we propose on all our WordPress hosting plans.
This cache system is extremely powerful and allows to get TTFB (server response time) of less than 100ms!
How does the FastCGI cache work?
FastCGI is a CGI protocol (for Common Gateway Interface), allowing to improve performance for dynamic content (typically WordPress) by processing several requests within the same process. The main use of FastCGI on Nginx is to process PHP requests.
Here is how a query takes place without the enabled FastCGI cache module:
- the web browser sends the request to the Nginx server which will pass it to FastCGI
- if the request calls PHP, FastCGI sends it to PHP-FPM to execute PHP code
- if necessary (almost always on WordPress), PHP-FPM will query the database to recover the content of the page
- PHP-FPM will then generate the HTML page and return it to Nginx
- Nginx can finally serve the web browser page
The problem with this way of handling the query is that PHP-FPM will take time to run the code and query the database while in many cases the page only offers static content!
This means that your page will take time to display and you will consume server resources (CPU and Memory Vive) for nothing.
This is where the FastCGI cache module comes in. Indeed, this module will allow you to store in cache the HTML page generated by PHP-FPM during the first query and no longer have to go through PHP-FPM at all for the following queries.
If we follow the example above, the process of processing the request is as follows:
- the web browser sends the request to the Nginx server which will pass it to FastCGI
- FastCGI recognizes the request and will search for HTML content in its cache
- Nginx serves the page directly to the web browser
What are the advantages of using the FastCGI cache for its WordPress site?
We see that Nginx processes the request independently via FastCGI, which offers many advantages:
- better performance: your page will display faster
- better availability: your page will display even if PHP or database no longer respond
- better scalability: your server will be able to process more requests in parallel (support more traffic)
- better ecological footprint: by relieving your server it is also energy that is saved and therefore a lighter ecological footprint for your website
How to configure the FastCGI cache for its WordPress site?
If you are hosted on Faaster
You have nothing to do!
FastCGI is pre-configured and we integrateI'm extending it to Nginx Helperto manage the cache from your WordPress site.
Cache of pages is a sensitive subject and can be subjected to many cases of figures.
That's why we offer many possibilities to customize the cache rules.
- Bypass of cache by URL: by inserting paths in the /app/cache.user.conf file
- Bypass of the cookie cache: by inserting cookies into /app/cookiescachebypass.user.conf
If you are using a WooCommerce store and your theme manages the ajax shopping cart, you can add the shopping cart and order pages to cache.user.conf and delete the cookies This will significantly boost performance for visitors with items in their basket.
Don't hesitate to use our support if you want us to handle it for you.
If you are not staying at Faaaster
If your host does not host the FastCGI cache natively and you are not an expert, the configuration of the FastCGI cache can be complex.
The simplest way is to contact your hosting provider's support and ask them to guide you!