How to install the extension

  1. Backup your store's database and web directory.
  2. Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
  3. Copy the installation instructions from the page My Downloadable Products to the SSH console and press ENTER.
  4. Run command php -f bin/magento module:enable Mirasvit_Core Mirasvit_CacheWarmer Mirasvit_Report to enable the extension.
  5. Run command php -f bin/magento setup:upgrade to install the extension.
  6. Run command php -f bin/magento cache:clean to clean the cache.
  7. Deploy static view files

    rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy

How to upgrade extension

To upgrade the extension follow these steps:

  1. Backup your store's database and web directory.
  2. Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
  3. Run command composer update mirasvit/module-cache-warmer to update the extension sources.
  4. Run command php -f bin/magento setup:upgrade to install updates.
  5. Run command php -f bin/magento cache:clean to clean the cache.
  6. Deploy static view files

    rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy

Disabling the Extension

Temporarily Disable

To temporarily disable the extension please follow these steps:

  1. Login to the SSH console of your server and navigate to the root directory of the Magento 2 store.
  2. Run command php -f bin/magento module:disable Mirasvit_CacheWarmer to disable the extension.
  3. Login in to the Magento back-end and refresh the store cache (if enabled).

Removing the Extension

To uninstall the extension please follow these steps:

  1. Login to the SSH console of your server and navigate to theroot directory of the Magento 2 store.
  2. Run the command composer remove mirasvit/module-cache-warmer to remove the extension.
  3. Login in to the Magento back-end and refresh the store cache (if enabled).

General Settings

Go to System > Page Cache Warmer > Settings. You will see the following settings:

General

  • Enabled - enables full page cache warmer.
  • Warm pages by - strategy for warming pages: by popularity (recomended) or by page type.
  • Ignored Pages - regular expressions for excluding pages from warmer.
    /\?/ - ignore pages with GET params
    /\?[\w]&[\w]&[\w]*/ - ignore pages with more than 2 GET params

Performance

  • Threads - the number of concurrent (parallel) requests to the store.
  • Delay between requests - delay between requests in milliseconds (1000 ms - 1 s).
  • Maximum job run time - maximum time allowed for one job run in seconds.
  • Job Schedule - cron expression for schedule warmer jobs.

Extended Settings

  • Don't verify peer - determines whether SSL certificates are validated for requests sent over a HTTPS connection.
  • Don't run warmer job if average system load more than (%) - If average system load will more than value in this field warmer will not start warming process.
    "Average system load" you can see in SYSTEM->Page Cache Warmer->Jobs.
  • Crawler limit - Crawler will stop crawling when quantity of URLs in cache will reach this value.
  • Forbid cache flushing - Forbid flush FPC cache. Cache can be flushed only in Cache Management or if TTL expired.
    If enabled store will stop flush FPC cache even if you change products.

Debug

  • Show cache staus - show block with info whether the page is in the cache in the frontend (it does not work for Vrnish).
  • Show debug hints only for - сomma separated IP addresses.
  • Log tags for cache flushing - Create tags log file /var/log/clean.log
  • Log backtrace for cache flushing - Create backtrace for cache flushing in file /var/log/clean.log

Cache Warmer Pages

Go to System > Page Cache Warmer > Pages. You will see warmed pages.

  • Warm Cache - add page to FPC cache.
  • Clean Cache - delete page from FPC cache.
  • Delete - delete url from pages list.

cache_warmer_pages.png

Cache Warmer Jobs

Go to System > Page Cache Warmer > Jobs. You will see Cache Warmer Jobs.

cache_warmer_jobs.png

FPC Reports

Note

This functionality will work only for Built-in mode (will not work for Varnish).
Go to System > Page Cache Warmer > FPC Reports. You will see FPC Reports.

Average Response Time - it is average time for Time To First Byte with cache and without cache.
Hit average response time - it is average time for Time To First Byte for pages which in cache.
Miss average response times - it is average time for Time To First Byte for pages without cache.

fpc_report_avg.png

Hit Count - quantity for visited cached pages
Miss Count - quantity for visited pages which is out of cache
Visit Count - quantity for visited pages (in cache and out of cache)

fpc_report_count.png

Time To First Byte - it is time which you can see on following image:

ttfb.png
More about Time To First Byte you can read here https://en.wikipedia.org/wiki/Time_To_First_Byte

Command Line Interface

Usage: php -f bin/magento [options]

  • mirasvit:cache-warmer --warm - warm the pages which you can see in SYSTEM->Page Cache Warmer depending on Performance configurations
  • mirasvit:cache-warmer --remove-all-pages - remove all pages from the module
  • mirasvit:cache-warmer:crawl - crawl all store pages except urls with "?" (from version 1.0.42)
  • mirasvit:cache-warmer:crawl --all - crawl all store pages (from version 1.0.42)
  • mirasvit:cache-warmer:crawl --store_id=2 - crawl all pages for store with ID 2
  • mirasvit:cache-warmer:crawl --base_url=http://example.com - crawl all pages for store with base url http://example.com
  • mirasvit:cache-warmer:cron - run cron jobs for the module
  • mirasvit:cache-warmer:test - for purpose of a module test

Frequently asked questions

What Page Cache warmer does?

Page Cache Warmer is a crawler (powered by Magento Cron job) which visits uncached pages like user and adds those pages to the cache. More pages will be in cache, so in result whole store will be faster. It can be used either Magento standard Cache or Varnish. It works with other cache types (like redis) without any problem. If you use varnish please check that it is configured correctly http://devdocs.magento.com/guides/v2.0/config-guide/varnish/config-varnish-configure.html (Verify HTTP response headers)

What can I do if all pages have "Pending" status?

Varnish:

If you set in STORES->Configuration->ADVANCED->System->Full Page Cache->Caching Application = Varnish Cache (Recommended) please check that Varnish is installed on server. For this run in command line as follows: varnishd -V. If result is corret you should see varnish version. varnishd_v.png Please switch store to Built-in mode ( STORES->Configuration->ADVANCED->System->Full Page Cache->Caching Application = Built-in Cache ) and set "Show cache status" = Yes in STORES->Configuration->Mirasvit Extensions->Page Cache Warmer->Debug and check if your pages are cacheable. You should see "PAGE HIT" hit.png If after second visit you see that pages are not cacheable ("PAGE MISS") you need to fix it (How can I make pages cacheable?). miss_blocks.png f you see "PAGE HIT" most likely Varnish is not configured to work with magento. You can check using this way http://devdocs.magento.com/guides/v2.0/config-guide/varnish/config-varnish-configure.html (Verify HTTP response headers).

Note

Our extension will work with your store only when Varnish will be configured correctly or if you switch store to Built-in mode ( STORES->Configuration->ADVANCED->System->Full Page Cache->Caching Application = Built-in Cache ).

Built-in Cache:

If you set in STORES->Configuration->ADVANCED->System->Full Page Cache->Caching Application = Built-in Cache set "Show cache status" = Yes in STORES->Configuration->Mirasvit Extensions->Page Cache Warmer->Debug and check if your pages are cacheable. If should see "PAGE HIT". If after second visit you see that pages are not cacheable you need fix it (How can I make pages cacheable?).

How check if my pages are cacheable?

Set in STORES->Configuration->ADVANCED->System->Full Page Cache->Caching Application = Built-in Cache After second visit you should see "PAGE HIT". hit.png If you see something like this miss_blocks.png on home page, category page or product page this means that page is not cacheable, because blocks ( customer, authorization-link-login, header) use "cacheable=false" in xml file. You need fix it (How can I make pages cacheable?)

How can I make pages cacheable?

If you see that page is not cacheable (home page, category page or product page) miss_blocks.png you need to connect to your server via ssh and run grep -r "[your_block_name].*cacheable" * --include="*.xml" where [your_block_name] is not cacheable block which you can see on Warmer info block.

Example: cd [magento_root_folder]/app/code grep -r "authorization-link-login.*cacheable" * --include="*.xml"

cd [magento_root_folder]/app/design grep -r "authorization-link-login.*cacheable" * --include="*.xml"

[custom_theme]/Magento_Customer/layout/default.xml <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" cacheable="false" template="account/link/authorization.phtml"/>

You see name="authorization-link-login" cacheable="false" in file [custom_theme]/Magento_Customer/layout/default.xml. So you need to delete cacheable="false"

After this you need to refresh all cache in Cache Management and you should see "PAGE HIT". hit.png

How can I stop cache flushing?

Looking on this image fill_rate.png you can see how often your store flushes cache (Page Cache Wermer don't have functionality for cache flushing). To see reason of the cache flushing you can enable "Log tags for cache flushing" and "Log backtrace for cache flushing" in Page Cache Warmer configuration. log.png Result will be in file /var/log/clean.log In most situations the reason of flushing will be very often reindex (FPC flush cache if you do reindex) or very often product save (FPC flush cache for depending pages if you save products). Also products can be saved via external servise using webapi. You may need to configure your system to not save products too often and process reindex not more than once per day. If it is impossible you can set "Forbid cache flushing=Yes".

Note

If Forbid cache flushing enabled FPC stops flushing cache on products and categories change. With the function enabled you can flush cache only in "Cache Management" or if cache will be expired (depends on TTL).

How can I control average system load?

In SYSTEM->Page Cache Warmer->Jobs you can see "Average system load". avg_system_load.png You can reduce system load by adding limit for "Don't run warmer job if average system load more than (%)" (for example 80). If average system load will be more than 80 warmer will not start warming process.