-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Envoy supports Redis pipelined commands, but does not batch commands. By batching, I mean when non-pipelined or pipelined commands are sent through Envoy, Envoy should not send them upstream to Redis until a certain number of commands has been received, and then write them to the connection buffer for a particular upstream Redis in one go.
Here are our scenarios and how we handle them currently:
- Pipelined - One or more packets with as many commands as fit
- Redis - Individual packets for each command
- Multiple Clients (workers on same instance for example), same Envoy- Individual packets for each command (or pipelined set of commands)
What we would like is that if Envoy receives GET 1, GET 2, GET 3 as discrete commands, they still get pushed up to Redis in the same packet.
Moreover, if we have multiple clients that are sending in Redis commands pipelined or not, they also get batched. For example if client #1 send GET 1, GET 2 and client #2 sends GET 3 GET 4 GET 5 in a pipeline, Envoy, assuming the buffer is big enough, should send all of these up in the same packet.
This is closer to what systems like Twemproxy do, and should be substantially faster. In my development VM, a preliminary implementation yielded a 3-5x improvement in throughput and latency.
I'll put up a PR for this next week and hopefully do some real-world performance testing next week or week after.