Skip to main content

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:
values.yaml

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:
values.yaml

Enable Redis Persistence

With Embedded Redis

Enable AOF (Append-Only File) persistence:
values.yaml
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:
values.yaml

Cluster Mode

For very high throughput:
values.yaml

AWS ElastiCache Integration

Create ElastiCache Cluster

Using AWS Console:
1

Navigate to ElastiCache

AWS Console → ElastiCache → Redis → Create
2

Cluster Settings

  • Cluster mode: Disabled (for simplicity)
  • Name: smallest-redis
  • Engine version: 7.0+
  • Node type: cache.r6g.large (or larger)
3

Subnet Group

Select subnet group in same VPC as EKS cluster
4

Security

  • Security group: Allow port 6379 from EKS cluster
  • Encryption in transit: Enabled
  • Encryption at rest: Enabled
5

Backup

  • Automatic backups: Enabled
  • Retention: 7 days
6

Create

Review and create (takes 10-15 minutes)Note the Primary endpoint

Configure Helm Chart

values.yaml

Performance Tuning

Memory Configuration

Set memory limits for embedded Redis:
values.yaml

Eviction Policy

Configure memory eviction:
values.yaml

Disable Persistence for Performance

For non-critical data (faster performance):
values.yaml
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:
redis-backup-cronjob.yaml

Restore from Backup

Pod will restart and load from backup.

Security

Enable Authentication

Always use password authentication:
values.yaml
Or use existing secret:
values.yaml

Enable TLS

For embedded Redis:
values.yaml

Network Policies

Restrict access to Redis:
redis-network-policy.yaml

Scaling Redis

Vertical Scaling

Increase resources:
values.yaml
Restart pods:

Horizontal Scaling

Add more replicas:
values.yaml

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

Enable password authentication even for internal Redis:
Use AOF for maximum durability:
At least 2 replicas for high availability:
Use Redis exporter for Prometheus:
Schedule automatic backups:
  • ElastiCache: Enable automatic backups
  • Self-managed: Use CronJob for BGSAVE

What’s Next?

HPA Configuration

Configure autoscaling for Lightning ASR

Metrics Setup

Set up Prometheus metrics collection