Thuta Learning
ရှာဖွေရန်
Redis
IntermediateData & Databasesbeginner

Pipeline နှင့် Batching

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Pipeline နှင့် Batching concept ကို နားလည်ရှင်းပြနိုင်ရန်
  • နမူနာ Redis command/code ကို ကိုယ်တိုင် run ပြီး output စစ်နိုင်ရန်
  • Tutorial Platform project နှင့် production scenario တွင် မှန်ကန်စွာအသုံးချနိုင်ရန်

နားလည်ထားရမယ့် အချက်

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 ရှိမရှိလည်းစစ်မယ်။

အတူတူ စမ်းရေးကြည့်မယ်

typescript
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}`);
});
You should see
Round trips နည်းသော bounded cache-warming batch ရမည်။

၅ မိနစ် စမ်းကြည့်

10,000 keys ဖတ်ရာတွင် batch 10/100/1000 အတွက် benchmark plan ရေးပါ။

သတိလေးတစ်ချက်

`multi()` API အချို့က transaction semantics ပါနိုင်လို့ client documentation ကိုစစ်ပြီး pipeline/transaction ကိုမရောပါနှင့်။

Redis — PipeliningRedis

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • `multi()` API အချို့က transaction semantics ပါနိုင်လို့ client documentation ကိုစစ်ပြီး pipeline/transaction ကိုမရောပါနှင့်။
  • နမူနာ command ကို production Redis ပေါ် တိုက်ရိုက်မစမ်းဘဲ local/test instance နဲ့ recoverable data ပေါ်တွင် အရင်အတည်ပြုပါ။

လေ့ကျင့်ခန်း

10,000 keys ဖတ်ရာတွင် batch 10/100/1000 အတွက် benchmark plan ရေးပါ။

You'll know it worked when: Round trips နည်းသော bounded cache-warming batch ရမည်။

Pipeline နှင့် Batching | Thuta Learning