4 ms·
Cache Them If You Can
- ars 15y ago> The HTTP Archive doesn’t save response bodies so the determination of “identical” is based on the resource having the exact same URL, Last-Modified, ETag, and Content-Length. I don't like this. Dynamic pages don't usually send any of those headers, so the page will appear identical in his analysis, despite not actually being identical.
- Destroyer661 15y agoOne of the largest improvements I've noticed in between caching and optimizing in PHP has been turning on APC. I'm not aware of any drawbacks, if you have any let me know. I didn't do any bench marking, but it did make a significant impact on page loads to my eye, as well as the stats on the page.
- driverdan 15y agoWhile backend caching isn't what the article is about, you're absolutely right that an opcode cache such as APC significantly improves backend performance. It's one of the first things I check for when I'm optimizing a client's PHP site.
- randomdrake 15y agoThis is a great suggestion. A while ago I did some benchmarks with hooking up APC and Squid proxy to the site I was working on at the time. The results were pretty amazing. I saw an increase in capability/performance of 400-700%. I'd probably choose Varnish over Squid if I had to do it again, however. The Squid configuration file is a bit of a nightmare. http://randomdrake.com/2009/07/14/benchmark-results-show-400-to-700-percent-increase-in-server-capabilities-with-apc-and-squid-cache/ http://randomdrake.com/2009/07/14/benchmark-results-show-400...
- HerraBRE 15y agoTo celebrate this article, I just set my cache size in Firefox to zero. Why? Aside from being a bit contrary by nature, I present the following... Fact: My netbook is memory constrained and the network is often faster than my local disk. Hunch: Caching content locally does nothing but thrash my disk, trash my FS cache and slow my entire computer down. We'll see how it pans out. :-)
- riobard 15y agothe network is often faster than my local disk I'm wondering what kind of network you have...
- HerraBRE 15y agoI have one of those fancy networks that can open multiple TCP/IP connections in parallel, whereas my Firefox disk cache lives on one of those crappy old spinning disks which can only do one seek at a time. :-)
- ww520 15y agoCached HTTP resources are usually small in 10K's to 100K's. You meant your netbook is so memory constrained that it can't afford some megabytes of cache memory?
- HerraBRE 15y agoI am talking about on-disk cache, not in-memory cache. Being memory constrained means I do not have a large filesystem cache and cannot afford to have it smashed by lots of cache reads/writes. It also means the odds that a cached (on disk) resource is actually in RAM is low, so a cache hit involves multiple disk seeks which very quickly adds up to more latency than fetching over the network - especially when you consider that I have one disk which cannot run multiple seeks in parallel, whereas the network round trips can overlap. Performance on modern computers very often boils down to avoiding disk seeks.
- 15y ago
- ww520 15y agoYSlow is a great tool in finding out whether caching is turned on for a resource.