BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Twemproxy – Proxy For MemCached And Redis

| by Roopesh Shenoy Follow 0 Followers on Dec 14, 2012. Estimated reading time: 1 minute |

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. 

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login 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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT