Pipelining jibgħat ħafna kmandi Redis f'round-trip tal-network waħda minflok li stennija għar-risposta ta' kull kmand qabel ma tibgħat l-ieħor. Ittejjeb drastikament it-throughput meta tkeċċi ħafna kmandi, minħabba li l-latency tal-network — mhux Redis stess — ħafnu drabi huwa l-bottleneck.
Il-problema: 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: batch il-kmandi
pipeline = redis.();
( id userIds) pipeline.();
results = pipeline.();
