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

Memory၊ Big Keys နှင့် Hot Keys

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

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

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

Redis capacity သည် raw payload size ထက် object overhead၊ allocator fragmentation၊ replication/persistence buffers များပါထည့်တွက်ရပါတယ်။ Big key က value/member count ကြီးပြီး command latency၊ deletion၊ network transfer ကိုထိခိုက်စေပါတယ်။ Hot key က traffic အများစု key တစ်ခုထဲကျသဖြင့် shard တစ်ခုကို overload ဖြစ်စေပါတယ်။

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

`INFO memory`၊ `MEMORY STATS`၊ sampled `MEMORY USAGE` နဲ့ baseline ဆောက်မယ်။ `redis-cli --bigkeys` ကို production-safe scan settings ဖြင့် run၊ hot-key sampling ကို LFU policy နဲ့စစ်မယ်။ Large collections ကို time bucket/smaller keys ခွဲပြီး unlink/asynchronous deletion စဉ်းစားမယ်။

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

shell
INFO memory
MEMORY STATS
MEMORY USAGE tutorial:42 SAMPLES 5
OBJECT ENCODING tutorial:42
UNLINK obsolete:large:key

# redis-cli --scan --pattern 'tutorial:*'
# redis-cli --bigkeys
You should see
Memory baseline နှင့် oversized key candidates စာရင်းရမည်။

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

2 KB average keys 5 million အတွက် 30% overhead + 20% headroom capacity estimate လုပ်ပါ။

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

Production တွင် full keyspace ကို aggressive scan သို့ `KEYS *` မလုပ်ပါနှင့်။ Sampling နဲ့ off-peak scan သုံးပါ။

Redis — Memory OptimizationRedis

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

  • Production တွင် full keyspace ကို aggressive scan သို့ `KEYS *` မလုပ်ပါနှင့်။ Sampling နဲ့ off-peak scan သုံးပါ။
  • နမူနာ command ကို production Redis ပေါ် တိုက်ရိုက်မစမ်းဘဲ local/test instance နဲ့ recoverable data ပေါ်တွင် အရင်အတည်ပြုပါ။

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

2 KB average keys 5 million အတွက် 30% overhead + 20% headroom capacity estimate လုပ်ပါ။

You'll know it worked when: Memory baseline နှင့် oversized key candidates စာရင်းရမည်။

Memory၊ Big Keys နှင့် Hot Keys | Thuta Learning