Pipelining ले एकै नेटवर्क राउन्ड-ट्रिप मा धेरै Redis commands पठाउछ भन्दा एक-एक कमान्डको जवाफको लागि पर्खनु पर्छ। यो धेरै commands जारी गर्दा throughput लाई नाटकीय रूपमा सुधार गर्छ, किनकि नेटवर्क latency — Redis आफैँ होइन — अक्सर bottleneck हो।
समस्या: राउन्ड-ट्रिप 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.();
