Pipelining प्रत्येक command के reply की प्रतीक्षा किए बिना अगला भेजने के बजाय कई Redis commands को एक single network round-trip में भेजता है। यह कई commands जारी करते समय throughput में नाटकीय रूप से सुधार करता है, क्योंकि network latency — न कि Redis स्वयं — अक्सर bottleneck होती है।
समस्या: round-trip latency
Normally each command is a request→reply round-trip:
send GET → wait for reply → send GET → wait for reply → ... (N × network latency)
→ Redis processes each command in microseconds, but each round-trip adds network
latency (e.g. 0.5ms). For 1000 commands, that's ~500ms JUST in waiting!
Pipelining: commands को batch करें
pipeline = redis.();
( id userIds) pipeline.();
results = pipeline.();
