Before knowing pipelining, first know the concept of Redis:
Redis is a TCP server which supports request/response protocol. In Redis, a request is completed in two steps:
What is Pipelining
Pipelining facilitates a client to send multiple requests to the server without waiting for the replies at all, and finally reads the replies in a single step.
Let's see an example of Redis pipelining. In this example, we will submit multiple commands to Redis once and Redis will provide the output of all commands in a single step.
Open Redis terminal and use the following command:
You can see that every time the value is incremented.
Advantage of Pipelining
The main advantage of Redis pipelining is speeding up the Redis performance. It drastically improves the protocol performance because of multiple commands simultaneous execution.
Pipelining vs Scripting
Redis Scripting is available in Redis version 2.6 or greater. A lot number of use cases for pipelining can be addressed more efficiently using scripts that perform a lot of the work needed at the server side.
The main advantage of scripting is that it can both read and write data with minimal latency. It makes operations like read, compute, write very fast.
On the other hand, pipelining doesn't use this scenerio. In pipelining, the client needs the reply of the read command before it can call the write command.