cancel
Showing results for 
Search instead for 
Did you mean: 

Varnish PageCache Test result "Expected HIT on the second page load"

Varnish PageCache Test result "Expected HIT on the second page load"

I have created a custom module for filter some product collection.

When I try to upload this extension to Magento marketplace. I pass the reviews Marketing Review, Code Sniffer and Copy Paste Detector. but facing an error on Installation & Varnish Test section.
The error is

Expected HIT on the second page load after product price update.
My extension has including Controller, Model, Observer and Plugin folders. not overriding any block from the extension.
 
 
Thanks in advance.
 
1 REPLY 1

Re: Varnish PageCache Test result "Expected HIT on the second page load"

Hii,
You can setup the Varnish cache on your server and Test it.

Main file is default.vcl so you need to follow below steps for testing in any particular magento.

Log in to the Magento Admin as an administrator.
Click Stores > Settings > Configuration > Advanced > System > Full Page Cache.
From the Caching Application list, click Varnish Caching.
Enter a value in the TTL for public content field.

 

The Varnish test also uses the :

php bin/magento setup:performance:generate-fixtures

command to install sample products to run the test against magento using file ./varnish-config/profile.xml

./varnish-config/profile.xml file contents : 

<?xml version="1.0"?>
<config xmlns:xi="http://www.w3.org/2001/XInclude">
    <profile>
        <admin_users>1</admin_users> <!--  Number of admin users to generate -->
        <websites>1</websites> <!--  Number of websites to generate -->
        <store_groups>1</store_groups> <!--Number of stores-->
        <store_views>1</store_views> <!--  Number of store views -->
        <assign_entities_to_all_websites>0</assign_entities_to_all_websites> <!--  Whether to assign all products per each website -->
        <simple_products>10</simple_products> <!--  Simple products count -->
        <categories>2</categories> <!--  Number of categories to generate -->
        <configs> <!--  Config variables and values -->
            <config>
                <path>admin/security/use_form_key</path>
                <scope>default</scope>
                <scopeId>0</scopeId>
                <value>0</value>
            </config>
            <config>
                <path>system/full_page_cache/caching_application</path>
                <scope>default</scope>
                <scopeId>0</scopeId>
                <value>2</value>
            </config>
        </configs>
    </profile>
</config>


Above code is already added to default.vcl

sub vcl_deliver {
    if (resp.http.x-varnish ~ " ") {
        set resp.http.X-EQP-Cache = "HIT";
    } else {
        set resp.http.X-EQP-Cache = "MISS";
    }
    ...
}

Also in frontend in network you can check X-EQP-Cache = "HIT" or X-EQP-Cache = "MISS" to chek if varnish is implemented.

Please check the Reference Image :
Image-1 
Image-2 
Image-3 

You can Take the references from the Below Links :
https://devdocs.magento.com/guides/v2.4/config-guide/varnish/config-varnish-magento.html 
https://devdocs.magento.com/marketplace/sellers/installation-and-varnish-tests.html 

Click on 'Kudos' & Accept as Solution to encourage to write more answers !
Thankyou