Memcache vs APC for a single server site data caching

user15063 picture user15063 · Nov 25, 2009 · Viewed 12.9k times · Source

I have a single server site thats pushing 200k unqiues per day, and the traffic doubles roughly every 40 days (for the last 5 months anyway).

I pretty much only plan to cache the output of mysql_query functions for an hour or so. If cache is older than that, run query, put result back into the cache for another hour.

My mysql DB is about 200mb in size (grows by maybe 10-20mb/month).

Im doing a lot of file caching by writing HTML outputs and using them for a few minutes, and then regenerating the html.

Unfortunately, since its a database site, that allows for many sorting, searching and ordering methods, as well as pagination.... there are over 150,000 cached pages. Im also not caching the search queries, which cause most of the load.

I'd like to implement a caching system, and I wanted to know which one is faster. Would love to see some benchmarks.

Answer

Strae picture Strae · Dec 1, 2009

A quick Googling says that APC is 5 times faster than Memcached.

My experience say that APC is nearly 7-8 times faster than Memcached.. but, memchached can be accessed by different services (for example, if you run mainly on apache and delegates some traffic, e.g. static contents like images or pure html, to another web-service, like lighttpd), that can be really usefull, if not indispensable.

APC have less feature than memcached and is easly to use and optimize, but this depends on your needs.