Pipelining يرسل عدة أوامر Redis في جولة شبكة واحدة بدلاً من انتظار رد كل أمر قبل إرسال التالي. يحسّن الإنتاجية بشكل كبير عند إصدار عدة أوامر، لأن زمن انتظار الشبكة — وليس Redis نفسه — غالباً ما يكون الاختناق.
المشكلة: زمن انتظار الجولة الواحدة
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: دمج الأوامر في مجموعات
pipeline = redis.();
( id userIds) pipeline.();
results = pipeline.();
