Pipelining ఎక్కువ Redis commands లను ఒకే network round-trip లో పంపుతుంది, ప్రతిটి command యొక్క reply కోసం వేచి ఉండకుండా తదుపరిని పంపుతుంది. ఇది చాలా commands జారీ చేసేటప్పుడు throughput ను నాటకీయంగా మెరుగుపరుస్తుంది, ఎందుకంటే network latency — Redis కాదు — తరచుగా병목 అవుతుంది.
సమస్య: 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.();
