Too much caching to code
Traditionally, and sensibly, one develops a site before attempting to optimise the server. The reason behind this being that simple changes to the site (modules or themes) that would require a page refresh to take effect could end up requiring either a site cache clear or even an Apache/PHP restart. After recently optimising a site on a server ready for production I had to undo a number of optimisations so development could continue, inspiring me to write this.
How much caching are we talking?
With a heavily optimised site, it's likely Memcache will be installed, Apache will be tuned and Drupal will have all the boxes ticked within the 'admin/config/development/performance' settings page.
The combination of these factors will in itself require the cache to be cleared when altering JS/CSS or even content on pages (since they are cached for anonymous). If the fantastic authcache module is installed, there are implications of cached pages for authenticated users too!
If APC is enabled there is the further risk that changes will not take effect until the next time apache/PHP is restarted. The documentation is accurate when advising the user to take care when changing the apc.stat setting. With apc.stat = 0, the files themselves are stored in the APC cache. So even if you make changes to files, they simply will not show the changes until either the APC cache is cleared or apache/PHP restarted.
Keeping files in APC cache can lead to issues and questions as to why changes are not taking effect; but in my experience production sites which do not require changing gain in performance such that the setting is worthwhile.
The right way
- Develop then optimise the server. Don't burden yourself with having to clear caches and restart things with every little successive change. Not only would it massively explode the length of time it would take to develop anything; it'd be damned annoying.
- Always have site optimisation in mind. Just because you're developing and creating a site, doesn't mean you can fill pages with enormous views chock full of JOIN queries. If you do that, you're going to have a bad time regardless of however you try to optimise the server.
- Optimise for the site in question. Plenty of other people have written about how to optimise Drupal. Use the resources but target them to your site; a small blog site with limited readers will not likely gain anything from CDNs, varnish and memcache.