HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
twitter
twemproxy
C2012–2023
twitter / twemproxy

twemproxy

A fast, light-weight proxy for memcached and redis

17Distinct people
20Mentions
0Explicit recommenders
12.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A fast, light-weight proxy for memcached and redis

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year20 dated mentions

Observed mentions: 2012-02-22 17:52:32 UTC to 2023-03-18 22:03:53 UTC.

02462012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 6 mentions; 2 submissions, 4 comments20122013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2023

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC624
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC303
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC101
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC312
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC312
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC202
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC000
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC000
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
twemproxy (nutcracker) twemproxy (pronounced "two-em-proxy"), aka nutcracker is a fast and lightweight proxy for memcached and redis protocol. It was built primarily to reduce the number of connections to the caching servers on the backend. This, together with protocol pipelining and sharding enables you to horizontally scale your distributed caching architecture. Build To build twemproxy 0.5.0+ from distribution tarball: $ ./configure $ make $ sudo make install To build twemproxy 0.5.0+ from distribution tarball in debug mode: $ CFLAGS="-ggdb3 -O0" ./configure --enable-debug=full $ make $ sudo make install To build twemproxy from source with debug logs enabled and assertions enabled: $ git clone git@github.com:twitter/twemproxy.git $ cd twemproxy $ autoreconf -fvi $ ./configure --enable-debug=full $ make $ src/nutcracker -h A quick checklist: Use newer version of gcc (older version of gcc has problems) Use CFLAGS="-O1" ./configure && make Use CFLAGS="-O3 -fno-strict-aliasing" ./configure && make autoreconf -fvi && ./configure needs automake and libtool to be installed make check will run unit tests. Older Releases Distribution tarballs for older twemproxy releases (<= 0.4.1) can be found on Google Drive. The build steps are the same (./configure; make; sudo make install). Features Fast. Lightweight. Maintains persistent server connections. Keeps connection count on the backend caching servers low. Enables pipelining of requests and responses. Supports proxying to multiple servers. Supports multiple server pools simultaneously. Shard data automatically across multiple servers. Implements the complete memcached ascii and redis protocol. Easy configuration of server pools through a YAML file. Supports multiple hashing modes including consistent hashing and distribution. Can be configured to disable nodes on failures. Observability via stats exposed on the stats monitoring port. Works with Linux, *BSD, OS X and SmartOS (Solaris) Help Usage: nutcracker [-?hVdDt] [-v verbosity level] [-o output file] [-c conf file] [-s stats port] [-a stats addr] [-i stats interval] [-p pid file] [-m mbuf size] Options: -h, --help : this help -V, --version : show version and exit -t, --test-conf : test configuration for syntax errors and exit -d, --daemonize : run as a daemon -D, --describe-stats : print stats description and exit -v, --verbose=N : set logging level (default: 5, min: 0, max: 11) -o, --output=S : set logging file (default: stderr) -c, --conf-file=S : set configuration file (default: conf/nutcracker.yml) -s, --stats-port=N : set stats monitoring port (default: 22222) -a, --stats-addr=S : set stats monitoring ip (default: 0.0.0.0) -i, --stats-interval=N : set stats aggregation interval in msec (default: 30000 msec) -p, --pid-file=S : set pid file (default: off) -m, --mbuf-size=N : set size of mbuf chunk in bytes (default: 16384 bytes) Zero Copy In twemproxy, all the memory for incoming requests and outgoing responses is allocated in mbuf. Mbuf enables zero-copy because the same buffer on which a request was received from the client is used for forwarding it to the server. Similarly the same mbuf on which a response was received from the server is used for forwarding it to the client. Furthermore, memory for mbufs is managed using a reuse pool. This means that once mbuf is allocated, it is not deallocated, but just put back into the reuse pool. By default each mbuf chunk is set to 16K bytes in size. There is a trade-off between the mbuf size and number of concurrent connections twemproxy can support. A large mbuf size reduces the number of read syscalls made by twemproxy when reading requests or responses. However, with a large mbuf size, every active connection would use up 16K bytes of buffer which might be an issue when twemproxy is handling large number of concurrent connections from clients. When twemproxy is meant to handle a large number of concurrent client connections, you should set chunk size to a small value like 512 bytes using the -m or --mbuf-size=N argument. Configuration Twemproxy can be configured through a YAML file specified by the -c or --conf-file command-line argument on process start. The configuration file is used to specify the server pools and the servers within each pool that twemproxy manages. The configuration files parses and understands the following keys: listen: The listening address and port (name:port or ip:port) or an absolute path to sock file (e.g. /var/run/nutcracker.sock) for this server pool. client_connections: The maximum number of connections allowed from redis clients. Unlimited by default, though OS-imposed limitations will still apply. hash: The name of the hash function. Possible values are: one_at_a_time md5 crc16 crc32 (crc32 implementation compatible with libmemcached) crc32a (correct crc32 implementation as per the spec) fnv1_64 fnv1a_64 (default) fnv1_32 fnv1a_32 hsieh murmur jenkins hash_tag: A two character string that specifies the part of the key used for hashing. Eg "{}" or "$$". Hash tag enable mapping different keys to the same server as long as the part of the key within the tag is the same. distribution: The key distribution mode for choosing backend servers based on the computed hash value. Possible values are: ketama (default, recommended. An implementation of https://en.wikipedia.org/wiki/Consistent_hashing) modula (use hash modulo number of servers to choose the backend) random (choose a random backend for each key of each request) timeout: The timeout value in msec that we wait for to establish a connection to the server or receive a response from a server. By default, we wait indefinitely. backlog: The TCP backlog argument. Defaults to 512. tcpkeepalive: A boolean value that controls if tcp keepalive is enabled for connections to servers. Defaults to false. preconnect: A boole
Read the full README on GitHub

What Hacker News says

20 sources
I haven't created Redis itself but a Redis client library. It all started with a chat server I wanted to write on top of Boost.Beast (and by consequence Boost.Asio) and at the time none of the clients available would fill my needs and wishes - Be asynchronous and based on Boost.Asio. - Perform automatic command pipelining [1]. All C++ libraries I looked at the time would open new connections for that, which results in unacceptable performance losses. - Parse Redis responses directly in their final data structures avoiding extra copies. This is useful for example to store json strings in Redis and read them back efficiently. With time I built more performance features - Full duplex communication. - Support for RESP3 and server pushes on the same connection that is being used for request/response. - Event demultiplexing: It can server thous
Read the rest
ands of requests (e.g. websocket sessions) on a single connection to Redis with back pressure. This is important to keep the number of connections to Redis low and avoid latency introduced by countermeasures like [3]. This client was proposed and accepted in Boost (but not yet integrated), interested readers can find links to the review here [2]. [1] https://redis.io/docs/manual/pipelining/ [2] https://github.com/boostorg/redis/issues/53 [3] https://github.com/twitter/twemproxy
In Build Your Own Redis with C/C++
twemproxy is not the best piece of software when it comes to maintenance of code quality. But it works reliable. We are still using twemproxy and we are maintaining our own fork of it. This fork often has changes from us, like bugfixes or introducing new redis commands that are not supported yet. Every bug we fix we apply this as a PR. A few PRs from the repository we have cherry-picked internally and deployed. But we have also a few issues with it like this one here: https://github.com/twitter/twemproxy/issues/442 or live reconfiguration would be a nice feature. Think about it if you really need this, because it is not only fun. A few pain points: * Deployments of new configs and restarting twemproxy on your server farm * New redis version with new commands? Extend twemproxy for those command support I don't now any _real_ alternative to
Read the rest
it, right now. I know from https://github.com/Netflix/dynomite which is a twemproxy fork. When we had only memcached and no redis (we are using both with twemproxy), then we would try https://github.com/facebook/mcrouter from facebook. But it is specialized on memcached. If you come up with an alternative, please let me know.
In Learn Redis the hard way: in production
Hi, thats a good point and the approach you describe would work for a single Redis instance. In our case, we were using Twemproxy in front of Redis and it doesn't support Redis's "SCRIPT LOAD" command so we would need a way to load the script on each Redis node ahead of time. One other concern when using EVAL and EVALSHA through Twemproxy is guaranteeing that all keys in the command map to the same Redis node, in our case we only had one key so wasn't a concern. Documentation on that can be found here https://github.com/twitter/twemproxy/blob/master/notes/redis...
In An Afternoon of Code Golf in Lua to Achieve 4x Performance in Redis
Some software that Twitter has put out: [1] Heron, a realtime, distributed, fault-tolerant stream processing engine - https://github.com/twitter/heron [2] Finagle, a fault tolerant, protocol-agnostic RPC system - https://github.com/twitter/finagle/ [3] FlockDB, a distributed, fault-tolerant graph database - https://github.com/twitter/flockdb [4] Gizzard, a flexible sharding framework for creating eventually-consistent distributed datastores - https://github.com/twitter/gizzard [5] Twemcache, a Twitter fork of Memcached - https://github.com/twitter/twemcache [6] Twemproxy, a fast, light-weight proxy for memcached and redis - https://github.com/twitter/twemproxy
In Twitter Plans Hundreds More Job Cuts as Soon as This Week
Twitter puts out a LOT of software, and open-sources a good portion. I don't know if this is smart in the sense of being overstaffed relative to their revenue, but they do it regardless. Some examples: [1] Fabric, an SDK for mobile apps - https://docs.fabric.io/android/fabric/overview.html [2] Heron, a realtime, distributed, fault-tolerant stream processing engine - https://github.com/twitter/heron [3] Finagle, a fault tolerant, protocol-agnostic RPC system - https://github.com/twitter/finagle/ [4] FlockDB, a distributed, fault-tolerant graph database - https://github.com/twitter/flockdb [5] Ruby implementation of the ICU (International Components for Unicode - https://github.com/twitter/twitter-cldr-rb [6] Clockwork Raven, Human-Powered Data Analysis with Mechanical Turk - https://github.com/twitter/clockworkraven [7] Gizzard, a flexible
Read the rest
sharding framework for creating eventually-consistent distributed datastores - https://github.com/twitter/gizzard [8] Twemcache, a Twitter fork of Memcached - https://github.com/twitter/twemcache [9] Twemproxy, a fast, light-weight proxy for memcached and redis - https://github.com/twitter/twemproxy [10] Iago, a webapp load tester - https://github.com/twitter/iago [11] Ospriet, a bestof/voting app - https://github.com/twitter/ospriet
In Vine isn’t growing and most of its top executives have left
can give back in many ways The standard way society compensates persons for useful goods and services is by exchanging currency, not by bartering favors or by saying "look! we made a billion dollars using your software, here, have these free 40 lines of code as a bug fix. thx." Unrelated note: every time I see these (needlessly?) optimized string compare statements, I fall out of my chair laughing and/or crying: https://github.com/twitter/twemproxy/blob/a36fdae2a8a3c166d9...
In Side projects
I don't want to argue your point and you should read heavily into the "tragedy of the commons" problem that plagues many open source communities, but companies can give back in many ways, in terms of bug fixes, features and improvements to the projects they use (at least wise companies do). In Twitter's case, we've also contributed to the Redis ecosystem via twemproxy: https://github.com/twitter/twemproxy Twemproxy helps scale some of the traffic for the top websites in the world: https://github.com/twitter/twemproxy#users
In Side projects

Showing the 15 most recent of 20 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.