Hacker News new | ask | show | jobs
by robotresearcher 5255 days ago
Does memcached not use virtual memory?
3 comments

Memcached is designed to be fast. Anything that makes it slower that doesn't need to be there isn't there. For example: authentication (anyone who can access the port can fetch data), indexing (you need to know the key), deallocating memory (you configure memcached with an upper bound; it keeps allocating memory as needed until it gets there), etc.

Virtual memory (I assume you actually mean 'does memcached not page data out to disk') would make it much slower. Since memcached is just that - a memory cache - if you're out of memory it just expires the least-recently-used data. In your application, you fetch the key, and if that fails you fetch it from the primary data store (or wherever else you can find it).

In theory it probably could, but you're losing all benefit at that point. The big selling point of memcahce is that it's VERY fast. Our memcache server (Ours is only 8GB, not nearly as impressive as some) averages under 1ms object fetch times, even accounting for network overhead.
IIRC memcached is event-driven and swapping is death for event-driven programs because it blocks the whole event loop.