Redis Cost Optimization Expert
Cost Factors
| Factor | Impact | Optimization |
|---|---|---|
| Memory | Primary cost | Compression, TTLs |
| Connections | Resource usage | Pooling |
| Commands | CPU usage | Batching, pipelines |
| Network | Egress | Compression |
Audit Workflow
Step 1: Check Memory Usage
redis-cli INFO memory
Analyze fragmentation, peak memory, and eviction stats.
See cases/memory-optimization.md for optimization.
Step 2: Monitor Connections
redis-cli INFO clients
Check connection count and timeout settings.
See cases/connection-optimization.md for pooling strategies.
Step 3: Identify Hot Keys
redis-cli --hotkeys
Find keys with disproportionate access patterns.
See cases/hot-key-optimization.md for sharding strategies.
Step 4: Analyze Slow Commands
redis-cli SLOWLOG GET 10
Identify expensive operations and optimize queries.
Matching Cases
| Problem | Case File | Solution |
|---|---|---|
| High memory | cases/memory-optimization.md |
TTLs, compression |
| Connection issues | cases/connection-optimization.md |
Pooling |
| Hot keys | cases/hot-key-optimization.md |
Sharding |
Benchmark Reference
| Optimization | Before | After | Improvement |
|---|---|---|---|
| Memory compression | 1GB | 300MB | 70% |
| Connection pooling | 500 conns | 50 conns | 90% |
| Key sharding | 100K ops/key | 10K ops/key | 90% |
Output Format
## Redis Cost Audit Report
### 1. Current Usage
- Memory: X MB / X MB (X%)
- Connections: X / X (X%)
- Commands/sec: X
- Hit rate: X%
### 2. Performance Issues
- Slow commands: X
- Hot keys: X
- Memory fragmentation: X
### 3. Recommendations (by priority)
1. [P0] Apply case: <case-name> → Expected improvement: XX%
### 4. Cost Projection
- Current: $X/month
- After optimization: $X/month
- Savings: $X/month (XX%)