redis-performance
Master Redis performance - memory optimization, slow log analysis, benchmarking, monitoring, and tuning strategies
When & Why to Use This Skill
This Claude skill provides a comprehensive toolkit for Redis performance optimization, focusing on memory management, latency reduction, and system stability. It empowers developers and SREs to diagnose bottlenecks using slow log analysis, conduct rigorous benchmarking, and implement advanced tuning strategies to ensure peak database efficiency and reliability in production environments.
Use Cases
- Memory Optimization: Analyze memory fragmentation and configure eviction policies (like allkeys-lru) to prevent Out-of-Memory (OOM) errors and optimize resource usage.
- Latency Troubleshooting: Identify and resolve high-latency commands using SLOWLOG and LATENCY DOCTOR to improve overall application response times.
- Capacity Planning & Benchmarking: Use redis-benchmark to simulate high-load scenarios and determine the throughput limits of your Redis instances before scaling.
- Proactive Health Monitoring: Track critical performance metrics such as cache hit ratios, operations per second, and big keys to maintain optimal system health.
| name | redis-performance |
|---|---|
| description | Master Redis performance - memory optimization, slow log analysis, benchmarking, monitoring, and tuning strategies |
| sasmp_version | "1.3.0" |
| bonded_agent | 08-redis-production |
| bond_type | PRIMARY_BOND |
| version | "2.1.0" |
| last_updated | "2025-01" |
| type | string |
| required | true |
| enum | [memory, latency, throughput, slow_queries] |
| max_retries | 3 |
| backoff_strategy | exponential |
| backoff_base_ms | 100 |
Redis Performance Skill
Memory Management
maxmemory 4gb
maxmemory-policy allkeys-lru
maxmemory-samples 10
Eviction Policies
| Policy | Description | Use Case |
|---|---|---|
| noeviction | Error on full | Critical data |
| allkeys-lru | Evict LRU | General cache |
| volatile-lru | Evict LRU with TTL | Session cache |
| allkeys-lfu | Evict LFU | Frequency-based |
Memory Analysis
INFO memory
MEMORY DOCTOR
MEMORY USAGE key
MEMORY STATS
redis-cli --bigkeys
Slow Log
CONFIG SET slowlog-log-slower-than 10000 # 10ms
CONFIG SET slowlog-max-len 128
SLOWLOG GET 10
SLOWLOG LEN
SLOWLOG RESET
Common Slow Commands
| Command | Fix |
|---|---|
| KEYS * | Use SCAN |
| SMEMBERS | Use SSCAN |
| HGETALL | Use HMGET |
Benchmarking
# Basic
redis-benchmark -q -n 100000
# With pipelining
redis-benchmark -q -n 100000 -P 16
# Specific commands
redis-benchmark -t set,get -n 100000 -q
Latency Monitoring
CONFIG SET latency-monitor-threshold 100
LATENCY DOCTOR
LATENCY HISTORY command
Key Metrics
| Metric | Healthy | Warning | Critical |
|---|---|---|---|
| Memory | <75% | 75-90% | >90% |
| Ops/sec | Baseline | +50% | +100% |
| Latency | <1ms | 1-10ms | >10ms |
| Hit ratio | >95% | 90-95% | <90% |
Assets
performance-config.conf- Optimized config
References
PERFORMANCE_GUIDE.md- Tuning guide
Troubleshooting
High Memory
INFO memory
redis-cli --bigkeys
Fix: Set eviction policy, add TTL
High Latency
SLOWLOG GET 10
LATENCY DOCTOR
Fix: Optimize slow commands
Error Codes
| Code | Name | Recovery |
|---|---|---|
| PERF001 | OOM | Increase maxmemory or evict |
| PERF002 | HIGH_LAT | Check slow log |
| PERF003 | FRAG | MEMORY PURGE or restart |