Added support for listening to same port from multiple twemproxy processes #435
+81
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My team (from IBM Security Trusteer) has ran into some bottlenecks when using twemproxy and developed this patch.
This patch allows to use socket option SO_REUSEPORT on twemproxy socket. This option is available on Linux kernel version 3.9+.
After stress testing our redis-server we found that handling many clients consumes too much processing from redis but not redis code itself rather its networking code (epoll/etc.).
It seems that the single thread nature of redis maxes out the networking part with one core in extreme conditions (like many connections scenario, no pipelining, etc.).
Using this patch we can connect many twemproxy instances (which runs on the same computer) to a redis server using the same socket, we were able to get a much greater throughput and still have one logical redis server.
These twemproxy instances can all be configured with the same configuration file, and only needs to have a different stats port. (we don't enable SO_REUSEPORT for that socket)