Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to use memcache with a single-server app?

For a single-server LAMP site (which is usually under quite high load), what is best way to use memcache?

Does it make sense to run the memcache daemon on the same server as the application, or is that just going to take valuable memory away from MySQL, giving a net performance loss. Does it even make sense to use memcache in this scenario- or is the best solution to always have dedicated servers for memcache?

I appreciate that profiling the site before and after would be required to really answer this question, but I would rather not do that at this stage on the live site. Especially as someone out there certainly knows the answer off the top of their head.

like image 290
DavidWinterbottom Avatar asked Oct 12 '08 18:10

DavidWinterbottom


1 Answers

Usually, the recommendation (see What about shared memory? in the memcached page) is to run memcached on the same machines as web servers, on the premise that web applications are CPU-heavy (which memcached is not), whereas memcached is memory-heavy (which most web applications are not, at least in comparison).

So, if your web server has plenty of memory, it's a good idea to run memcached on it. YMMV.

like image 127
Chris Jester-Young Avatar answered Nov 01 '22 13:11

Chris Jester-Young