twemproxy
https://github.com/twitter/twemproxy
A fast, light-weight proxy for memcached and redis
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.
https://zhuanlan.zhihu.com/p/351244798#:~:text=Twemprox
标签:protocol,twemproxy,Twemproxy,--,redis,scalable,proxy,memcached From: https://www.cnblogs.com/lightsong/p/18449602Twemproxy是一种代理分片机制,由Twitter开源。Twemproxy作为代理,可接受来自多个程序的访问,按照路由规则,转发给后台的各个Redis服务器,再原路返回。该方案很好的解决了单个Redis实例承载能力的问题。当然,Twemproxy本身也是单点,需要用Keepalived做高可用方案。通过Twemproxy可以使用多台服务器来水平扩张redis服务,可以有效的避免单点故障问题。虽然使用Twemproxy需要更多的硬件资源和在redis性能有一定的损失(twitter测试约20%),但是能够提高整个系统的HA也是相当划算的。不熟悉twemproxy的同学,如果玩过nginx反向代理
或者mysql proxy,那么你肯定也懂twemproxy了。其实twemproxy不光实现了redis协议,还实现了memcached协议,什么意思?换句话说,twemproxy不光可以代理redis,还可以代理memcached,官方说明:
twemproxy (pronounced "two-em-proxy"), akanutcracker is a fast and lightweight proxy formemcachedandredis protocol
. It was built primarily to reduce the number of connections to the caching servers on the backend. This, together with protocol pipeling and sharding enables you to horizontally scale your distributed caching architecture.
Twemproxy架构:
但是从上面我们可以看到这样以来Twemproxy就成了单点,所以通常会结合keepalived来实现Twemproxy的高可用。架构图如下:
上面的架构通常只有一台Twemproxy在工作,另外一台处于备机,当一台挂掉以后,vip自动漂移,备机接替工作。关于keepalived相关的资料可以参考我前面相关文章。