နားလည်ထားရမယ့် အချက်
Redis Cluster က keyspace ကို 16,384 hash slots ခွဲပြီး primary nodes များကြား distribute လုပ်ပါတယ်။ Client က MOVED/ASK redirects နားလည်ရပါတယ်။ Multi-key command/script keys များ same slot ဖြစ်ရန် `{...}` hash tag သုံးနိုင်သော်လည်း tag အလွန်ကျယ်ရင် hot shard ဖြစ်နိုင်ပါတယ်။ Cluster က horizontal capacity ပေးသော်လည်း operations complexity တိုးပါတယ်။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Coupon script keys ကို `coupon:{42}:remaining` နဲ့ `coupon:{42}:claims` လုပ်ပြီး same slot ထားမယ်။ `CLUSTER KEYSLOT` နဲ့စစ်၊ node/slot health monitor၊ rolling maintenance နဲ့ reshard test လုပ်မယ်။ Dataset/throughput တစ် node capacity မကျော်သေးလျှင် Sentinel deployment ကိုပဲရွေးနိုင်ပါတယ်။
အတူတူ စမ်းရေးကြည့်မယ်
CLUSTER INFO
CLUSTER NODES
CLUSTER SLOTS
CLUSTER KEYSLOT coupon:{42}:remaining
CLUSTER KEYSLOT coupon:{42}:claims
CLUSTER COUNTKEYSINSLOT 9030Cluster health၊ node ownership နဲ့ related keys slot တူကြောင်းစစ်နိုင်မည်။၅ မိနစ် စမ်းကြည့်
Tenant hash tag strategy တစ်ခုရေးပြီး noisy tenant hotspot ဖြစ်နိုင်ပုံနဲ့ mitigation ရေးပါ။
သတိလေးတစ်ချက်
Hash tag ကို `{tenant}` တစ်ခုတည်းဖြင့် tenant ကြီးတစ်ခုရဲ့ keys အားလုံးပေါင်းမထားပါနှင့်။ Sharding benefit ပျောက်နိုင်ပါတယ်။
Redis — Cluster Specification — Redis