Hot Key Detection Without LFU Eviction Policy (Defualt mode)
For clusters that do not have the maxmemory policy set to LFU, the only practical workaround (without modifying the Valkey core) is to extract access counts from the output of the MONITOR command. Because MONITOR is resource-intensive, it will be run at configurable intervals to collect a representative sample of commands. This sample will provide sufficient data for parsing key access counts in the Timeseries Metrics Server. Additionally, users can specify the maximum number of commands to collect per interval to prevent out-of-memory (OOM) errors.
Future Performance Optimization
For hot key detection in clusters that have the maxmemory policy set to LFU, the application will implement a two-phase approach that prioritizes performance:
Hot Slot Identification: It first analyzes slot-level metrics already exposed by Valkey, focusing on four key dimensions: key count, CPU usage, network bytes in, and network bytes out. This initial analysis identifies performance hotspots at the slot level without requiring expensive SCAN operations across the entire cluster.
Scoped Key Scanning: It then performs targeted key scans within only the identified hot slots. This reduces the cost of expensive scan operations while preserving accuracy in hot key detection. The scan logic uses undocumented but functional capabilities in Valkey to isolate hot keys without requiring a full cluster scan, helping avoid performance degradation in production environments.
Hot Key Detection Without LFU Eviction Policy (Defualt mode)
For clusters that do not have the maxmemory policy set to LFU, the only practical workaround (without modifying the Valkey core) is to extract access counts from the output of the MONITOR command. Because MONITOR is resource-intensive, it will be run at configurable intervals to collect a representative sample of commands. This sample will provide sufficient data for parsing key access counts in the Timeseries Metrics Server. Additionally, users can specify the maximum number of commands to collect per interval to prevent out-of-memory (OOM) errors.
Future Performance Optimization
For hot key detection in clusters that have the maxmemory policy set to LFU, the application will implement a two-phase approach that prioritizes performance:
Hot Slot Identification: It first analyzes slot-level metrics already exposed by Valkey, focusing on four key dimensions: key count, CPU usage, network bytes in, and network bytes out. This initial analysis identifies performance hotspots at the slot level without requiring expensive SCAN operations across the entire cluster.
Scoped Key Scanning: It then performs targeted key scans within only the identified hot slots. This reduces the cost of expensive scan operations while preserving accuracy in hot key detection. The scan logic uses undocumented but functional capabilities in Valkey to isolate hot keys without requiring a full cluster scan, helping avoid performance degradation in production environments.