Some beginner questions

Martin Atkins mart at
Sun May 21 16:01:29 UTC 2006

Peter Van Dijck wrote:
> Hi, some beginners' questions.
> (I promise I'll write up what I learn for beginners on my blog so it
> can help others too.)
> 1) Memory usage. The examples say configure it with 2Gigs.  Is all the
> data send to memcache stored in ram memory? If my webserver only has
> 1G ram, is it ok to allocate 500M to memcache?

The benefits of memcached are negated if the data ends up on disk. 
Whether you can allocate 500MB depends on what other things are 
happening on your server; you'll need to leave enough room for the other 
processes on the machine to run, obviously.

> 2) Where to run it?
> My webserver now has my db and my website (php, mysql) running on it.
> The site is rather db intensive. Should I first put the db on a
> separate server, and wait with memcache, or should I use my first
> separate server for memcache, keep the db on the main webserver?

I think the general "best practice" is to put memcached on the 
webservers and not on the database servers. This is because webapps 
generally tend to use less memory than databases. In general though you 
can just run memcached on any machine that has some RAM going to waste. 
memcached uses very little CPU.

> 3) What server to get?
> I have 1 dedicated server now, probably slowly growing to a few more
> over the next 6 months. Should I plan for dedicated memcache servers?
> And if so, should I focus on paying for lots of memory? Or rather pay
> for lots of processor speed? Or lots of storage? It seems like if I
> take a dedicated memcache server, I should pay for lotsa memory and
> keep processor and storage cheap, is that more or less right? Any
> rules of thumb?

Yes, memcached is RAM-heavy and CPU-cheap. The disks are irrelevant as 
far as memcache goes. You could, in theory, just netboot your memcached 
nodes and not have disks in them at all. Depending on your application, 
though, dedicated memcached nodes might be overkill; unless your webapps 
use loads of RAM you've probably got spare capacity on those servers 
that could be used for memcache, especially if you invest in webservers 
with loads of RAM!

More information about the memcached mailing list