What is PipeLining?
Pipelining is a form of asynchronous task execution. A Pipeline is a task that is composed of many subtasks. Each subtask may be dependent on its previous subtasks.
t1 => t2 => t3 ^ t4 =|
t2 depends on t1. t3 is dependent on t2 & t4.
While we are executing subtask t3 for primary task S1, we can also execute subtask t1 for another primary task S2. This is a pipelined execution.
How Redis Pipelining helps in Client-Server communication?
Each network request between the client and server involves a latency named Round-Trip-Time. Redis server reads a request from a client and client waits till the server writes the response.
We can rather ask the client to send many requests at once and collectively wait for the responses.
This helps us achieve:
- Ability to counter RTT of a network.
- Better throughput for client
- Saves multiple reads from server to client.
- The server sends single write with all responses
- POP3 uses pipelining