Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What are some good modules or systems that for caching that I can use for decreasing my load on Apache on an EC2 server running PHP, and why would you choose them?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

Here are some popular, industry standard techniques to increase your speed. You can try them out depending on your exact configuration:

Memcached

Memcached is a general-purpose distributed memory caching system that is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.

http://memcached.org/

Varnish Cache

Varnish is an HTTP accelerator designed for content-heavy dynamic web sites. In contrast to other HTTP accelerators, such as Squid, which began life as a client-side cache, or Apache, which is primarily an origin server, Varnish was designed from the ground up as an HTTP accelerator.

http://www.varnish-cache.org/

Mod_pagespeed

Page Speed is a tool and library that identifies improvements that can be made to web-sites to improve their latency. mod_pagespeed automates the application of those rules in an Apache server. HTML, CSS, JavaScript, and images are changed dynamically during the web serving process, so that the best practices recommended by Page Speed can be used without having to change the way the web site is maintained.

http://googlewebmastercentral.blogspot.com/2010/11/make-your-websites-run-faster.html

HBase

HBase is an open source, non-relational, distributed database modeled after Google's BigTable and is written in Java. It is developed as part of Apache Software Foundation's Hadoop project and runs on top of HDFS (Hadoop Distributed Filesystem), providing BigTable-like capabilities for Hadoop. That is, it provides a fault-tolerant way of storing large quantities of sparse data.

http://hbase.apache.org/

Cheat on Slow-Start

Slow-start is part of the congestion control strategy used by TCP, the data transmission protocol used by many Internet applications. Slow-start is used in conjunction with other algorithms to avoid sending more data than the network is capable of transmitting, that is, to avoid causing network congestion.

http://blog.benstrong.com/2010/11/google-and-microsoft-cheat-on-slow.html

share|improve this answer

+1 to cwd for the mod_pagespeed suggestion.

If your goal is to reduce the load on Apache, and assuming Apache is the front-line daemon receiving HTTP requests (i.e. there's no cache between the user and Apache) you should be giving a lot of attention to client-side optimization, specifically reducing page weight and reducing the number of requests needed to load a page. mod_pagespeed is going to do a lot of these on the fly, but because it's an Apache module it's going to incur a little Apache load just to do those optimizations.

It's going to maximize client-side caching using expiration headers etc. without you needing to tune the Apache configuration in detail, which is a win. It might be good to do some of the other optimizations (combining or bundling CSS and Javascript files to reduce the number of each needed to build the page, CSS image spriting to reduce the number of images loaded per page) on your own to reduce the load on mod_pagespeed.

You can look at Google's Page Speed tool (linked from the mod_pagespeed page) and/or the Yslow extension for the Firebug Firefox plug-in to find good client-side optimizations for your pages.

share|improve this answer

cwd's answer is excellent, just add a PHP opcode cacher (APC, eaccelerator, xcache) if the processing is PHP-heavy.

share|improve this answer
    
This is a good idea, I thought about that but forgot to mention it. –  pjmorse Feb 6 '11 at 22:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.