Mod_pagespeed, Varnish and Apache cache issues after new code pushes
Posted
by
WerkkreW
on Server Fault
See other posts from Server Fault
or by WerkkreW
Published on 2011-07-15T16:22:01Z
Indexed on
2013/10/18
21:59 UTC
Read the original article
Hit count: 202
I have a rather strange issue. In my environment we are running a load balanced cluster of 8 apache servers with a master-master MySQL backend. In front of apache we have Varnish in the cache layer.
We have been running Apache mod_pagespeed for several weeks now and for the most part it has been working great. The issue arises when we do fresh code updates from Git, and and/all of the JS/CSS assets change.
Basically the problem appears to be two fold. One, after the code push we generally take the opportunity to flush varnish, restart apache, and restart varnish. In doing this all of the mod_pagespeed combinied/minified files are cleared out ensuring that all of the new JS/CSS assets are fresh. The problem is, upon doing this the file names that mod_pagespeed creates change, but the old files (appear) to be still cached for many people client side leading to very unexpected results. However, if we do not restart apache, the changes to the files may or may not appear client side due to the cached minified assets.
The simple solution is to disable mod_pagespeed, however I would rather not do that as it has made a fairly large impact in performance.
I feel as if there must be a better way to deal with the inconsistencies in cache between the client and server to prevent having people to go to great lengths or perform a large number of page refreshes to see a working page.
I can provide configuration snippets if anyone needs them.
If you would like to inspect the site, source, headers, or anything try the following addresses:
Thanks in advance!
© Server Fault or respective owner