- name
- redis-audit
- description
- Redis cost optimization expert. Analyzes memory usage, connection management, command patterns, hot keys, and provides optimization strategies. Trigger when user mentions Redis costs, memory optimization, or Redis audit.
- when_to_use
- - User asks about Redis billing
- User needs to optimize memory usage
- User encounters Redis performance issues
- User needs to audit Redis configuration
- User wants to reduce Redis expenses
- allowed-tools
- Bash(redis-cli *)
# 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
```bash
redis-cli INFO memory
```
Analyze fragmentation, peak memory, and eviction stats.
See `cases/memory-optimization.md` for optimization.
### Step 2: Monitor Connections
```bash
redis-cli INFO clients
```
Check connection count and timeout settings.
See `cases/connection-optimization.md` for pooling strategies.
### Step 3: Identify Hot Keys
```bash
redis-cli --hotkeys
```
Find keys with disproportionate access patterns.
See `cases/hot-key-optimization.md` for sharding strategies.
### Step 4: Analyze Slow Commands
```bash
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%)
```
Auf GitHub ansehen