Skip to content

Aggregate hot keys across cluster nodes - #279

Merged
ravjotbrar merged 20 commits into
mainfrom
feature/aggregate-hotkeys
Apr 15, 2026
Merged

ravjotbrar merged 20 commits into
mainfrom
feature/aggregate-hotkeys

Conversation

@ravjotbrar

@ravjotbrar ravjotbrar commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Hot keys fan-out & aggregation

  • Hot key requests are fanned out to all nodes in clusterNodesRegistry when a clusterId is present
  • Results are aggregated by summing access counts per key, with size and TTL preserved from the first node that has them
  • Hot keys state is keyed by clusterId for cluster connections

Error handling

  • A yellow warning banner is shown when partial data is returned alongside node errors
  • Node-level errors are collected per node and returned alongside data in hotKeysFulfilled rather than firing individual hotKeysError messages
  • If all nodes fail or monitor isn't running, a fulfilled response with empty data is still sent so the UI displays the new banner

Hot key calculation fix

  • calculateHotKeysFromMonitor previously counted every command argument as a key. It now only counts args[0] for single-key commands, all args for mget/json.mget, and every other arg for mset

Cluster topology fix

  • Added refreshAllClusterRegistriesLoop to periodically broadcast updated cluster topology to all connected clients
  • Simplified reconcileClusterMetricsServers — removed getInitialClient indirection, increased reconcile interval to 10s

Misc

  • Renamed clusterNodesMap → connectedNodesByCluster throughout for clarity
  • Added clusterNodesRegistry to the Deps type so all action handlers have access to the full cluster node map

Change Visualization

Include a screenshot/video of before and after the change.

ravjotbrar and others added 12 commits April 14, 2026 15:24
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <83892020+ravjotbrar@users.noreply.github.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
@ravjotbrar ravjotbrar changed the title Feature/aggregate hotkeys Aggregate hot keys across cluster nodes Apr 15, 2026
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Comment thread apps/frontend/src/components/monitoring/hot-keys.tsx Outdated
Comment thread apps/frontend/src/components/monitoring/hot-keys.tsx Outdated
Comment thread apps/frontend/src/components/monitoring/hot-keys.tsx Outdated
Comment thread apps/metrics/src/analyzers/calculate-hot-keys.js Outdated
Comment thread apps/server/src/actions/hotkeys.ts Outdated
Comment thread apps/server/src/connection.ts
Comment thread apps/server/src/index.ts
Comment thread apps/server/src/index.ts
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
Signed-off-by: Ravjot Brar <ravjot.brar@improving.com>
@ravjotbrar
ravjotbrar merged commit 778b253 into main Apr 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants