နားလည်ထားရမယ့် အချက်
Pipeline က commands များကို responses စောင့်မနေဘဲ batch ပို့လို့ RTT overhead လျှော့ပါတယ်။ Pipeline သည် transaction မဟုတ်ဘဲ အခြား clients commands များကြားဝင်နိုင်ပါတယ်။ Batch အလွန်ကြီးရင် client/server output buffers နှင့် event loop ကိုဖိစီးလို့ bounded chunks သုံးရပါတယ်။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Tutorial cards 500 ခု cache warm လုပ်ရာတွင် 50/100-key chunks ဖြင့် pipeline လုပ်မယ်။ Per-command errors ကို result array ထဲစစ်၊ latency နဲ့ memory ကိုတိုင်းပြီး concurrency limit ထားမယ်။ Independent GET များအတွက် client auto-pipelining ရှိမရှိလည်းစစ်မယ်။
အတူတူ စမ်းရေးကြည့်မယ်
const multi = redis.multi();
for (const tutorial of chunk) {
multi.set(`tutorial:${tutorial.id}:v1`, JSON.stringify(tutorial), { EX: 300 });
}
const results = await multi.exec();
results.forEach((result, i) => {
if (result instanceof Error) throw new Error(`item ${i}: ${result.message}`);
});Round trips နည်းသော bounded cache-warming batch ရမည်။၅ မိနစ် စမ်းကြည့်
10,000 keys ဖတ်ရာတွင် batch 10/100/1000 အတွက် benchmark plan ရေးပါ။
သတိလေးတစ်ချက်
`multi()` API အချို့က transaction semantics ပါနိုင်လို့ client documentation ကိုစစ်ပြီး pipeline/transaction ကိုမရောပါနှင့်။
Redis — Pipelining — Redis