BT

Twemproxy – Proxy For MemCached And Redis

by Roopesh Shenoy on Dec 14, 2012 |

Twemproxy is a proxy server that allows you to reduce the number of open connections to your Memcached or Redis server.

What is Twemproxy useful for? It can

  • reduce the number of connections to your cache server by acting as a proxy
  • shard data automatically between multiple cache servers
  • support consistent hashing with different strategies and hashing functions
  • be configured to disable nodes on failure
  • run in multiple instances, allowing client to connect to the first available proxy server
  • Pipelining and batching of requests and hence saving of round-trips

Salvatore Sanfilippo(@antirez), the creator of Redis, wrote an article about how this can allow a Redis cluster to function even before the Redis-cluster feature is available, without losing much performance in most cases –

What's awesome about Twemproxy is that it can be configured both to disable nodes on failure, and retry after some time, or to stick to the specified keys -> servers map. This means that it is suitable both for sharding a Redis data set when Redis is used as a data store (disabling the node ejection), and when Redis is using as a cache, enabling node-ejection for cheap (simple) high availability.

This Thing Is Fast. Really fast, it is almost as fast as talking directly with Redis. I would say you lose 20% of performances at worst.

My only issue with performances is that IMHO MGET could use some improvement when the command is distributed among instances.

Twemproxy was open-sourced by Twitter earlier this year supporting Memcached and recently added support for Redis as well. Twitter uses cache servers extensively to deliver upto 300k tweets per minute; you can have a look at the presentation Real-Time Delivery Architecture At Twitter for more information. 

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Twemproxy Code flow by Roopesh Shenoy

Charsyam has a nice brief slide on Twemproxy code flow - charsyam.wordpress.com/2012/12/13/%EC%9E%85-%EA...

Nice Code by Qiu Tao

Nice

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT