Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
litespeed_wiki:cache:litemage2:troubleshooting [2018/06/04 20:32]
Lisa Clarke [Verify if Magento build-in cache working or not] Proofreading
litespeed_wiki:cache:litemage2:troubleshooting [2019/11/12 21:14]
Jackson Zhang
Line 41: Line 41:
  
 {{ :​litespeed_wiki:​cache:​litemage2:​litemage-pagecache-enable.png?​800 |}} {{ :​litespeed_wiki:​cache:​litemage2:​litemage-pagecache-enable.png?​800 |}}
 +
 +==== EnableDebug "Yes and set X-LiteMage-Debug response headers"​ ====
 +LiteMage 2.1.0 and above includes the **X-LiteMage-Debug response headers** feature, designed to make troubleshooting easier. ​
 +
 +When you try everything in the wiki but you still are not seeing an ''​X-LiteSpeed-Cache:​ hit,​litemage''​ header, enable this debug feature to collect more information.
 +
 +Navigate to **Magento Admin > Stores > Advanced > LiteMage Cache > Developer Settings**, and set **Enable Debug** to ''​Yes and set X-LiteMage-Debug response headers''​. You can also add your IP to to the **Log Debug Messages Only for Listed IPs** field to show the debug header to your IP only.  ​
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-enable-debug-response-headers1.png?​800 |}}
 +
 +Once enabled, you can browse your site, and use the browser'​s developer tool to check the header:
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-enable-debug-response-headers-2.png?​800 |}}
 +
 +In this case, the **Headers** show:
 +  x-litemage-debug-cc: ​
 +  x-litemage-debug-info:​ Layout has uncacheable blocks mgs_gdpr_login_header,​ wishlist-link-header,​ wishlist_header,​ wishlist_header, ​
 +  captcha-header
 +  x-litemage-debug-tag: ​
 +  x-litemage-debug-vary:​
 +  ​
 +The info ''​Layout has uncacheable blocks mgs_gdpr_login_header,​ wishlist-link-header,​ wishlist_header,​ wishlist_header, ​
 +  captcha-header''​ tells you that there are five blocks which are causing the page to be uncacheable. If you want to cache the page, you will either need to disable to blocks, or modfiy the template to make them ''​cacheable''​.
 ==== Page is not cachable because of "​cacheable"​ is set to "​false"​==== ==== Page is not cachable because of "​cacheable"​ is set to "​false"​====
 If you followed every step in the installation wiki and still do not see the ''​X-LiteSpeed-Cache:​ hit,​litemage''​ header for that page/for all pages, it is likely that the page is non-cacheable due to a setting from another plugin. If you followed every step in the installation wiki and still do not see the ''​X-LiteSpeed-Cache:​ hit,​litemage''​ header for that page/for all pages, it is likely that the page is non-cacheable due to a setting from another plugin.
Line 122: Line 143:
 To fix the problem, remove the ''/​home/​$USER/​lscache''​ folder completely and restart the web server. The cache root folder (normally ''/​home/​$USER/​lscache''​) will be created with correct ownership and permissions automatically during the restart. After restart, you should see the ''​x-litespeed-cache:​hit,​litemage''​ header. To fix the problem, remove the ''/​home/​$USER/​lscache''​ folder completely and restart the web server. The cache root folder (normally ''/​home/​$USER/​lscache''​) will be created with correct ownership and permissions automatically during the restart. After restart, you should see the ''​x-litespeed-cache:​hit,​litemage''​ header.
    
 +===== LSCache Vary Cookie Problem Causing Cache Miss =====
 +==== Diagnose the Issue ====
 +With LiteMage2 enabled, open a brand new Chrome Incognito window to test the site and check the headers. You may see a cache vary cookie being set. This is a signal that the first visit from a new user sets a cache vary cookie but is not cached. On the second visit you might see cache miss, and a cache hit on the third. ​
 +
 +If you do a few rounds of testing, make sure to close the incognito window completely and open a new window for each round. This is required to simulate a brand new user.
 +
 +First visit:
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary0.png?​800 |}}
 +
 +Second Visit:
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary1.png?​800 |}}
 +
 +Third Visit:
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary3.png?​400 |}}
 +
 +Next, you can use another browser such as Firefox to simulate a different user and check the same page. On the first visit, you will see the cache vary cookie being set. The second visit, since the page has already been cached, you will see a cache hit. (If the page has not yet been cached, you will see cache miss on the second visit and cache hit on the third.)
 +
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary4.png?​400 |}}
 +
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary5.png?​400 |}}
 +
 +There is an ''​_lscache_vary''​ set, which causes all new users' first visit to always be a cache miss. 
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary2.png?​500 |}}
 +
 +For such a case, if you run a benchmark test through ''​ab''​ or ''​curl'',​ the result will be invalid, since the cache will never be hit: ''​curl -I http://​yourdomain.com/''​
 +
 +  HTTP/1.1 200 OK
 +  X-Powered-By:​ PHP/7.0.31
 +  Set-Cookie: store=he; expires=Thu,​ 15-Aug-2019 20:52:58 GMT; Max-Age=31536000;​ path=/; HttpOnly
 +  Set-Cookie: PHPSESSID=8d10hs84hmc881dl014s00ffm6;​ expires=Wed,​ 15-Aug-2018 21:52:58 GMT; Max-Age=3600;​ path=/; ​
 +  domain=carolinalemke.goomla.co.il;​ HttpOnly
 +  Set-Cookie: wp_customerId=deleted;​ expires=Thu,​ 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=carolinalemke.goomla.co.il
 +  Set-Cookie: wp_customerGroup=deleted;​ expires=Thu,​ 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; ​
 +  domain=carolinalemke.goomla.co.il
 +  Set-Cookie: store_eu_ES=8d10hs84hmc881dl014s00ffm6;​ expires=Wed,​ 15-Aug-2018 21:52:58 GMT; Max-Age=3600;​ path=/; ​
 +  domain=carolinalemke.goomla.co.il;​ HttpOnly
 +  Set-Cookie: X-Magento-Vary=e3cb9ab3566a693edff3edf82caa39b1ed79e8ba;​ path=/; HttpOnly
 +  Set-Cookie: searchReport-log=0;​ path=/; HttpOnly
 +  Set-Cookie: _lscache_vary=9f858da3f6bbcc2862bc85d64d1b8ecb1bf2c076;​ path=/; HttpOnly
 +  X-Magento-Tags:​ store,​cms_b,​cms_b_footer_secure_payment,​cms_b_footer_develop_by,​cms_b_promotional_mailings,​cms_b_takanon,​cms_p_2
 +  X-Content-Type-Options:​ nosniff
 +  X-XSS-Protection:​ 1; mode=block
 +  X-Frame-Options:​ SAMEORIGIN
 +  Pragma: no-cache
 +  Cache-Control:​ max-age=0, must-revalidate,​ no-cache, no-store
 +  Expires: Tue, 15 Aug 2017 20:52:59 GMT
 +  Content-Type:​ text/html; charset=UTF-8
 +  Date: Wed, 15 Aug 2018 20:52:58 GMT
 +  Accept-Ranges:​ bytes
 +  Server: LiteSpeed
 +  X-UA-Compatible:​ IE=edge
 +  Connection: Keep-Alive
 +
 +==== Fix the Problem ====
 +To fix the problem, you will need to locate the plugin or toolbar that is causing the LiteMage cache vary.
 +
 +In this example, we have found an accessibility plugin on the homepage which causes such a problem. You may have other plugins such as a currency switcher plugin, a language plugin or a geolocation plugin, which does the same.
 +
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary6.png?​400 |}}
 +
 +The accessibility plugin can be further expanded to the following if you click it:
 +
 +{{ :​litespeed_wiki:​cache:​litemage2:​litemage2-cache-vary7.png?​400 |}}
 +
 +You will need to disable this type of plugin if you want a new user to hit the cache on their first visit. ​
 +
 +If you still want to use the plugin, it is not going to be as bad as you may think. This issue only impacts a user's first visit to one page (not the first visit to //each// page). For the rest of the user's visits, all pages can be served from cache, presuming they have already been cached by previous visitors. ​
 ===== How to setup cache warm up for Magento 2 using LiteMage 2 ===== ===== How to setup cache warm up for Magento 2 using LiteMage 2 =====
 Magento 2 warm up is not available yet. You could set public TTL to a longer time at this stage instead, for example 24 hrs, if applicable. Magento 2 warm up is not available yet. You could set public TTL to a longer time at this stage instead, for example 24 hrs, if applicable.
  • Admin
  • Last modified: 2020/07/08 19:33
  • by Lisa Clarke