Skip to main content

Overview

For production environments where horizontal scaling is required, use Redis as your Arivu memory backend.

Pros ✅

  • Distributed architecture - Share state across multiple workers
  • High performance - In-memory data store with microsecond latency
  • Scalable - Handles high concurrency efficiently
  • Cluster support - Redis cluster for fault tolerance
  • Session sharing - Multiple instances can access the same sessions
  • Requires external service - Must run a Redis server
  • Data persistence overhead - Requires configuration for durability
  • Memory constraints - Limited by available RAM

Configuration

Redis must be installed and running before Arivu can connect to it. Choose a setup method below:
1

Set Environment Variables

Add these to your .env file:
2

Verify Connection

Test your Redis connection:
3

Initialize Arivu

Start using Redis in your Python code:

Connection String Format

Performance Optimization

Connection Pooling

RedisBackend automatically handles connection pooling, so you don’t need to configure it manually.
Configure RDB or AOF to ensure your data survives Redis restarts:
Redis stores everything in RAM. Monitor memory usage to prevent out-of-memory errors.
  • Set a max memory policy: maxmemory-policy allkeys-lru
  • Monitor with redis-cli INFO memory
  • Clean up old sessions regularly
For high availability, use Redis Cluster:

Production Deployment

When to Use Redis

Use Redis when you:
  • Need to scale horizontally (multiple workers)
  • Require high performance and low latency
  • Want to share sessions across services
  • Are deploying to production
  • Need fault tolerance and failover
Redis is ideal for microservices architectures where multiple Arivu instances need to share session state.

Monitoring & Troubleshooting

Test your Redis connection:
Problem: Cannot connect to RedisSolutions:
  • Ensure Redis server is running: redis-cli ping
  • Check connection string is correct
  • Verify firewall rules allow the port
  • Check credentials if using authentication
Problem: Redis consuming too much memorySolutions:
  • Review session retention policies
  • Clear old sessions: redis-cli FLUSHALL (use with caution)
  • Set max memory limit: maxmemory 2gb in config
  • Monitor with redis-cli INFO memory
Problem: Slow session operationsSolutions:
  • Check Redis response times: redis-cli --latency
  • Verify network connectivity
  • Consider Redis clustering for high load
  • Monitor with redis-cli --stat