Close

July 15, 2015

Magento Memcache Combined CSS Wrong Urls

Lately we ran into a repeated issue that caused a significant amount of confusion for our development team. A Magento EE client has a fairly robust caching system setup: CDN, Varnish, Memcache and then Magento EE’s FPC.

The CSS and JS are combined on production, so if any changes are made to either, they would need to be flushed (“Flush Javascript/CSS Cache”). The problem is that flushing that alone will NOT trigger Magento to rebuild all of the older Full Page cached pages, so they all become stale.

In order to do so, you need to immediately then hit the “Flush Magento Cache” button, which forces a rebuild of everything (FPC probably would be enough).

An random issue happened where a user would get a stale copy of the page being returned to them that had the older combined CSS/JS files attached. We at first suspected that Varnish was not being called, but confirmed that the page being served by Varnish was a “miss” for the cache. No matter how many attempts we did with Varnish/Magento Cache, the correct page would not be built.

We next checked Memcache and found that it was NOT grabbing the latest version of the generated page. There was a inconsistency between the page built time in Magento and what Memcache was seeing (still being investigated). So Memcache never retrieved the newer version of the page.

The new CSS/JS devops procedure is to roll out the code, flush JS/CSS, Flush all Magento Cache and force a Memcache clear ( telnet localhost 11211 and then type flush_all). Hopefully this will save some folks some time in investigating.