Magento2: Enable Cache Monitoring in Magento 2

Created on 30 Sep 2017  路  2Comments  路  Source: magento/magento2

As a developer I would like an easy way to monitor Magento's full page cache efficiency so that I can code my customizations to maximize FPC cache hit rate

As a systems admin setting up a SOHO (<$1M/year rev) merchant on a single machine/VM I would like an easy way to monitor cache hit rates so that I can easily identify extensions that negatively impact cache hit rates

Notes:

  • Check out Tony Brown's talk which builds off work @mpchadwick did to show how we can better monitor cache hit rates in Varnish
    * Fast.ly live logging apis can provide similar data as Varnish
    *
    In apache we can leverage this code in similar ways for File/Redis cache by adding the header to the web server log. Though File/Redis cache is significantly less advanced then Varnish in M2
    * Apache -> LogFormat "%h %l .... "%{header name}i" ... "
  • Assume there are a # of different ways to pipe this log data into various tools for analysis and cache hit rate monitoring so only covering core changes to support
  • Per talk
    * Add the route as a header in the execute method of the controllers that render a page
    *
    Update VCL template
    ** could run varnishncsma command and get appropriate data to monitor cache hit rates down to specific Magento actions

Bonus Section:

  • Contribute a PR to dev docs with info on how to access/use this added logging information (such as NewRelic configuration, etc).

AC:

  • Can now monitor cache hit rates down to specific Magento actions based on data from Varnish logs
FrameworCache Format is not valid feature request up for grabs

All 2 comments

I missed this initially, so note that this is specific to FPC cache rates. It's fairly easy to track this in NGINX by taking the number of requests for the vhost that accepts external traffic and proxies it to varnish as compared to the requests to the vhost that runs the FastCGI requests. @sitewards we use https://github.com/knyar/nginx-lua-prometheus for this purpose (among others).

Additionally, native instrumentation exists for Varnish and redis, which can be used to calculate hit rates.

I will create a feature request for a broader framework for instrumentation for the core stack.

Edit: https://community.magento.com/t5/Magento-2-Feature-Requests-and/Create-a-mechanism-to-checkpoint-time-series-data-for-use-in-the/idi-p/76504

Please refer to the Community Forums or the Magento Stack Exchange site for advice or general discussion about this issue. The GitHub issue tracker is intended for Magento Core technical issues only.

Was this page helpful?
0 / 5 - 0 ratings