Hot key
Note: All 1-4 bullet points could be used separately.
Detect hot key (step2/3)
The one showed in the flowchart is a dynamic approach. There are several ways to decide hot keys:
Within proxy layer
Within client
Use redis shipped commands ./redis-cli --hotkeys
Randomly hash to multiple nodes instead of only one (step4)
Enable local cache for hot keys (step5)
Circuit breaker kicks in if detecting cache failure (step6)
References: https://juejin.im/post/6844903765733015559
βββββββββββββββββ
β β
β Client β
β β
β β
βββββββββββββββββ
β β β
β β β
β β β ββββββββββββββββββββββββ
β β β β Configuration center β
β β β β β β β β β β step0. subscribe to hot key changes β β β β βΆβ β
β β β β β (e.g. Zookeeper) β
β Step1: β ββ¬ββββββββββββββββββββββ
β Requests β β β β²
β come in β β β
β β β β β β
β β β ββββββββββββββStep3. Hot key change is publishedββββββββββββββ β
β β β β β
β β β β β
β β β β Yes
β β β β β
βΌ βΌ βΌ βΌ β
βββββββββββββββββββββββββββββββββββ β
β App Cluster β β
β β step 2: βββββββββββββββββββββββββββ .βββββββββ.
β β β β β β β β β β β β β β β β β aggregate β Stream processing β β± β²
β local local local ββββto detect ββΆβ ββββββΆ(Is it hot key)
β β cache β β cache β β cache β β hot keys β (e.g. Flink) β `. ,'
β β β β β β β β β β β β β β βββββββββββββββββββββββββββ `βββββββ'
β β² β
β β β β¬ β β β β β β β β β β β β β β
β β step 6. circuit breaker β
β β β β β
β β βββ β β β β β β β β β β β β β
βββββββ¬ββββββββββββββββββββββββββββ
β β step4. For the same hot key,
β β randomly map to multiple nodes
ββββββββββββββββ β instead of only 1
β Step5. Cache β βββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
βhot key withinβ β β
β local cache β β β
ββββββββββββββββ ββββββββββββΌβββββββββββββββββββββββββββββββββββββββΌβββββββββββ
β β β β β β β β β β β β β β β β β β β β β β β β β β
β distributed β distributed β distributed β β
β β cache node A β cache node B β cache node C β
β β β β β β β β β β β β β β β β β β β β β β β β β β
β β
β Cache Cluster β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Last updated