tags:

views:

182

answers:

2

I currently have about 650,000 items in memcached (430MB memory used) and the number is still increasing. It's expected to exceed 1,000,000 items before going flat. Current hit/miss ratio is 25:1 so the efficiency is pretty good. I just wanted to ask is one million items in memcached on single server too many? If not, how many is too many?

A: 

"Too many" is effectively however many you have when you run out of spare memory to dedicate to memcached.

The data is stored in a giant hash table, making lookups very close to O(1). As a hash table grows, collisions theoretically increase, but good quality (and suitable-for-memcached) implementations of the hash table concept generally include ample means to help deal with this with very little slowdown.

Nicholas Knight
+1  A: 

You could scale up to a single 64-bit server with 48GB, and put up to 80,000,000 items in it. Or you could scale out and buy many 4GB servers and put up to 2,400,000 items on each. Memcached works wonderfully well when you distribute it across multiple servers.

Jim Ferrans
@Jim, thanks for your answer, so 2,400,000 is the maximum number of items memcached can store in a 4GB box?
jack
Sorry, that's a rough estimate based on your current 650k items in 430MB. But 1m items is well under the max for such a machine. You'll need to consider what happens as the *volume* of cache accesses goes up (does the CPU or the network become a bottleneck?) and also what happens if the memcached machine goes down. Even if a single machine could handle the cache and the load, you may need two or more to support failover for your application.
Jim Ferrans