Preamble
Redis Pipeline is technique for improving performance by wrapping up bunch of Redis commands into a single process, without waiting for the response to each individual command.
Round-Trip Time (RTT)
Redis client-server using TCP connection to established, where the client send redis command to the server and client waiting for server to response, that’s how Redis command executed without Pipeline, it’s still ok if you only execute one command, when you execute multiple command it’s going to be faster if you use pipeline.
No Pipeline
Client ask to open connection to server, and execute one redis commands through one TCP request, and client do the same but with different redis command, until 3 times and connection closed.
Pipeline
Client ask to open connection to server, and execute several
redis commands through one TCP request, and server executing all commands that client sent, without response each command status to client, after server done, it will send response to client that pipeline already execute those commands.
Benchmark Result
This benchmark data generated by golang benchmark, I use golang as the redis client for prove which one is faster by comparing bulk insert 1024 data, using Non Pipeline & Pipeline.
Non Pipeline
Non Pipeline take more and more time, through data quantity from 1 to 1024, it’s going slower because Non pipeline execute insert command and waiting the response, and executed inside different TCP Request, it’s mean if the data quantity increase it goes slow, because the client perform 1024 TCP Request to server.
Pipeline
Pipeline time execution is almost linear, with pipeline the client perform multiple command that sent through one TCP Request, and server execute all the commands and response to client when all commands already execute, pipeline process 1024 command faster.
Conclusion
It's all depends on your need, don't over engineering simple task, if you need to perform multiple commands with faster, you can go with pipelined command, otherwise if you just perform one command you can go with non pipelined command.
My Thanks
Thank you for visiting! This article was originally published on another website. You can find the original source here. I'm excited to bring it over here. I hope you found it useful and enjoyable. Don't hesitate to reach out if you have any questions or feedback. Happy reading!