Redis Persistence
Overview
Redis provides caching and state management for Smallest Self-Host. This guide covers configuring Redis persistence, high availability, and performance optimization.
Redis Deployment Options
Option 1: Embedded Redis (Default)
Smallest Self-Host includes Redis as a subchart.
Advantages:
- Simple setup
- Automatic configuration
- Included in Helm chart
Disadvantages:
- Single point of failure
- No data persistence by default
- Limited to cluster resources
Configuration:
Option 2: External Redis
Use Amazon ElastiCache or self-managed Redis.
Advantages:
- Managed service (ElastiCache)
- High availability
- Better performance
- Independent scaling
Disadvantages:
- Additional cost
- More complex setup
Configuration:
Enable Redis Persistence
With Embedded Redis
Enable AOF (Append-Only File) persistence:
This creates:
- 1 master pod with persistent volume
- 2 replica pods with persistent volumes
- Automatic failover
Verify Persistence
Check PVCs created:
Expected output:
High Availability
Sentinel Mode
Redis Sentinel provides automatic failover:
Cluster Mode
For very high throughput:
AWS ElastiCache Integration
Create ElastiCache Cluster
Using AWS Console:
Cluster Settings
- Cluster mode: Disabled (for simplicity)
- Name: smallest-redis
- Engine version: 7.0+
- Node type: cache.r6g.large (or larger)
Configure Helm Chart
Performance Tuning
Memory Configuration
Set memory limits for embedded Redis:
Eviction Policy
Configure memory eviction:
Disable Persistence for Performance
For non-critical data (faster performance):
Without persistence, all data is lost if Redis restarts. Only use for truly ephemeral data.
Monitoring Redis
Check Redis Status
Connect to Redis CLI
Inside redis-cli:
Monitor Memory Usage
Monitor Performance
Backup and Recovery
Manual Backup
Create snapshot:
Copy RDB file:
Scheduled Backups
Create CronJob for automatic backups:
Restore from Backup
Pod will restart and load from backup.
Security
Enable Authentication
Always use password authentication:
Or use existing secret:
Enable TLS
For embedded Redis:
Network Policies
Restrict access to Redis:
Scaling Redis
Vertical Scaling
Increase resources:
Restart pods:
Horizontal Scaling
Add more replicas:
Troubleshooting
Connection Refused
Check Redis pod is running:
Test connection:
Out of Memory
Check memory usage:
Increase memory limit or enable eviction:
Slow Performance
Check latency:
Check slow queries:
Data Loss
Check if persistence is enabled:
Best Practices
Always Use Authentication
Enable password authentication even for internal Redis:
Enable Persistence for Production
Use AOF for maximum durability:
Use Replicas for HA
At least 2 replicas for high availability:
Monitor Redis Metrics
Use Redis exporter for Prometheus:
Regular Backups
Schedule automatic backups:
- ElastiCache: Enable automatic backups
- Self-managed: Use CronJob for BGSAVE

