OpenCart Varnish FPC Module:
One cannot deny that a website’s speed is an essential component of a flourishing online business.
Moreover, a faster-performing website will occupy a top position in a Search Engine Result Page (SERP). The reason is, a speedy website shall encounter lesser bounce rates.
Therefore, optimizing a website’s speed is extremely exigent and one way is caching. Where caching helps speed up the website, it even helps manage and cut down the server load.
What caching does is, store the data in a database or memory, or anywhere else, and then deliver it when there is a need, without generating it over and again and again.
The Varnish Cache:
Meanwhile, a Varnish Cache is a helping hand for websites that encounter heavy traffic daily.
Known as Caching HTTP Reverse Proxy, it is an HTTP accelerator, placed in between the client and backend (or the Apache Server).
It thus minimizes and caches the requests which the web application server delivers to the client or the host.
On receiving the requests from the client, varnish sends a cached request to the server which in turn forwards a response to the varnish.
There may be cases when varnish doesn’t accept requests from the client. In this case, it sends the request to the backend which again forwards the response to the varnish which sends a cached response data to the client.
Opencart Varnish FPC Module incorporates the features of the Varnish Cache.
This means, to make the Opencart website perform faster, one must move forth and integrate the Varnish Cache with their Opencart website.
This module allows the admin to set a few configurations for setting the varnish, such as Host Name, Port Number, Access IP List, First Byte Timeout, Between Byte Timeout, Connection Timeout, Backend Polling, etc.
Where the varnish cache feature will provide faster page load times and enhance the user experience for the customers, it even adds on to improvise the SEO of the website.
Note:
- For installing the Varnish Cache, one can click here.
Watch the below video tutorial to understand the extension workflow:
Features
- The admin needs to set the Host IP and also the Port Number of the server.
- An Access List, which includes a list of IPs, takes in the IP of the default host when not chosen by the admin.
- The admin has to configure the First Byte and Between Byte timeouts (in secs).
- A Connection Timeout is set within which the server must send the response to the varnish.
- A cache time to live is set by the admin which stores the copy of your website’s resources.
- The admin may even enable the Backend Polling where the client requests are sent to the server if the varnish cannot respond to the request.
- Varnish help reduce network bandwidth consumption as well as instigate faster page load times.
Installation
Upload Files
First, extract the downloaded zip file. After that, open the correct Opencart Version Folder. According to Opencart Version installed in your system.
Then, upload admin and catalog to the Opencart root directory.
Refresh Modifications
The user can navigate through Extensions > Modifications. Now click the Refresh button.
Edit User Groups
After that, go to System > Users > Usergroups. And then edit ‘Administrator’. Click Select All for both Access Permission and Modify Permission and Save it.
Install
Now navigate to Extensions > Extensions > Modules. Find Webkul Varnish Cache from the list. Click the Install button as visible in the screenshot below.
Admin Permissions: Varnish FPC
After successfully installing OpenCart Varnish FPC Module the admin must navigate through Extensions > Extensions > Modules to set the configurations.
The admin must tap on the Edit button of Webkul Varnish Cache present in the given list of extensions, and move forth with setting the configurations.
It redirects to the Webkul Varnish Cache page where the customers need to configure the fields such as Host Name, Port Number, First Byte, or Between Byte or Connection Timeout, etc.
The configurations for Varnish Cache can be set as under-
Status: Initially, the admin must Enable the status of this module.
Backend Host: The IP address of the user’s host (device).
Backend Port: The admin configures the port number of the backend or server.
Access List (Allowable Purge IP list): The admin may set more than one IP. If no IP is set then it takes in the IP of the default host.
First Byte Timeout (in a sec): The admin can set the first-byte timeout duration in seconds. It is the time frame within which the client must receive the response to the first request.
Between Byte Timeout (in a sec): The between byte timeout duration in seconds which is the response timeout duration between two successive requests.
- To know more about these terminologies, click here.
Connection Timeout (in secs): The connection timeout duration in seconds after which a 503 error shall display.
Grace Period: The time duration for which the client can hold the resources before releasing them to the varnish.
Cache Time-to-Live (TTL): The admin defines a time-to-live period in seconds. It is a process of storing the copy of the website’s resources such as images, texts, videos, etc.
By Pass URL: The admin lists the URLs of the website pages which do not require caching.
Backend Polling: The admin may enable or disable it. On enabling it, the client requests are sent to the server if the varnish cannot respond to the client requests.
Accept-Encoding: If the admin enables this field, the Js, CSS files, and images will get saved in the compressed form in the varnish.
Altering/ Modifying Settings: Varnish FPC
Subsequently, if the admin makes any changes or updates any configuration, relevant to the Varnish Cache settings, then firstly, the VCL file must be exported by clicking the Export VCL file tab and adding the changes to the default.vcl file.
For instance, the admin alters the First Byte Timeout duration to 200 secs.
Thereafter, the admin must click on the Export VCL File tab on the top-right corner of the Webkul Varnish Cache page as shown in the image below.
On doing so, it downloads a default.vcl file as shown in the above image. One can find this file image by navigating through-
/ etc/ varnish/ default.vcl file.
Further, download and add changes to the deafult.vcl file.
Note:
- VCL or the Varnish Configuration Language, which is a domain-specific language, entertains or includes a description of the request handling and document policies relevant to Varnish Cache.
Thereafter, open the terminal and write the following code to restart the varnish to update the configurations-
sudo /etc/init.d/varnish restart
Further, to check the code status of the varnish, one can type the following code-
sudo / etc/init.d/varnish status
Monitoring Varnish FPC Connectivity: With the Opencart’s Website
To check the website’s connectivity with Varnish Cache, one can simply log in to examine the same.
For instance, the user can view whether a website’s homepage connectivity with varnish cache is a “Hit or Miss.”
For that, the user must inspect the page, navigate to Network > Headers > All > Page Path.
This will display the details of the varnish connectivity as shown in the image below which depicts X-Cache as HIT.
Alternate Method: to Ensure Varnish connectivity with the Website
The user can even type the following command to check the varnish connectivity of a website’s homepage.
curl -I http://ocvarnish.webkul.com/index.php?route=common/home
That’s all for the Opencart Varnish Cache. If you face any issue, feel free to add a ticket at webkul.uvdesk.com
Current Product Version - 2.0.0.1
Supported Framework Version - 2.x.x.x, 3.x.x.x
Be the first to comment.