Book Image

Learning Redis

By : Vinoo Das
Book Image

Learning Redis

By: Vinoo Das

Overview of this book

Table of Contents (16 chapters)
Learning Redis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Pipelines in Redis


Redis provides a mechanism for faster execution, called pipeline. This groups up all the commands as one command block and sends it to the server for execution. The results of all the commands get queued in a response block and sent back.

Comparing the way pipeline works with multiple individual commands sent across a connection will give us an idea of how pipeline is more efficient and where it needs to be used. Let's assume a scenario where we have to send three commands to Redis. The time taken to send any command to Redis is X seconds, so the same amount of time is required to send the response. The total time spent in going and return journey is 2X seconds. Let's also assume that the time taken for execution is another X seconds. Now in the pipeline commands, since we are sending three commands as one block, the time taken for going to Redis is around X seconds , the time taken for processing all the three commands is 3X seconds, and the time taken for the return journey...