Hacker News new | past | comments | ask | show | jobs | submit login
Memcache internals (2011) (adayinthelifeof.nl)
72 points by ra7 on Dec 31, 2016 | hide | past | favorite | 16 comments



Is memcache still in heavy use? It seems like everyone I see has replaced it with Redis, but I don't know if this is a real tendency or the HN bubble/magpie developer effect.


To my knowledge, Memcached really only wins when you can make use of it being multi-threaded -- have a lot of concurrent key requests. Even though Redis runs single-threaded, it often will do more IOPs with respect to a single Memcached thread, and that's without considering that you can get even further ahead pipelining Redis requests.

To compete with Memcached's multi-core throughput, it's probably not a big deal for you to run a Redis process per core. Surely you are already running multiple memcached for higher availability, so I can't see multiple Redis procs adding much more complexity.

Of course, Redis has many more advantages. For one, I can't be bothered to ever again not have Redis data types, so Memcached just doesn't make sense in my stacks. And even a caching layer has advantages in being able to persist to disk, so I love that too about Redis.


If you need an in memory cache, you use memcached. If you need data structures and have trivial data sets (this is an enviable position) you use redis.

If you don't know why you need one or the other, use redis until you can't anymore. Plenty of people still use memcache, although lots of the current users are forking their implementation to get specific behaviors from the internals.


"trivial data sets... you use redis"

Can you elaborate on what you mean by "trivial data sets" and why is redis only suitable for those?


Just check the docs: strings, integers, lists, hashes, sets, sorted sets, geo etc


So you mean trivial data types? Well how's memcached (the other alternative in this discussion) gets you less trivial data types? Quite the contrary in fact.


That's welcoming downvotes. I don't remember memcache giving you any list/set/hash. Go check the docs.


From what I gathered (from talking to people), I think most startups and people starting projects nowadays will use Redis, but many companies have existing stacks that are still using Memcache.


I use it heavily because sometimes you just want a huge key / value cluster.

Running redis as a cluster is much more complicated.


From my experience, biggest weakness about memcache is that client libraries for it are crappy or at least the one for java. Otherwise it seems like it is great for what it is (a memory cache).

Redis rides a bit on its hype IMO, and I see that sometimes it is not used correctly.


memcache's home page still lists big players (Wikipedia, Flickr, Wordpress.com, Craigslist, etc), and more are listed on the Wikipedia entry. Are you saying a large portion of those users switched to Redis?


I think the threading model is one of the most interesting part in memcached. Unfortunately is not covered here but can be read from the sources quite easily.


Care to give a summary?



(February 2011)


Thanks, added.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: