The Data Normalization Platform v3.22.0 includes a Redis caching layer that provides 10x throughput improvement (from 20-30 req/s to 1,000+ req/s for cached data) with sub-millisecond response times.
Current Status: localhost:6379, which may not be available in production.
Add the following environment variables to enable the Redis caching layer:
# Redis Configuration
REDIS_HOST=your-redis-host.example.com
REDIS_PORT=6379REDIS_HOST=localhost
REDIS_PORT=6379# AWS ElastiCache
REDIS_HOST=your-cluster.cache.amazonaws.com
REDIS_PORT=6379
# Redis Cloud
REDIS_HOST=redis-12345.c123.us-east-1-1.ec2.cloud.redislabs.com
REDIS_PORT=12345
# Azure Cache for Redis
REDIS_HOST=your-cache.redis.cache.windows.net
REDIS_PORT=6380- Open the Manus project dashboard
- Navigate to Settings → Secrets panel
- Click Add Secret
- Add
REDIS_HOSTwith your Redis hostname - Add
REDIS_PORTwith your Redis port (default: 6379) - Restart the application
# Set environment variables
export REDIS_HOST=your-redis-host.example.com
export REDIS_PORT=6379
# Restart the application
cd /home/ubuntu/name-normalization-demo
pnpm devCreate a .env file in the project root:
# .env
REDIS_HOST=your-redis-host.example.com
REDIS_PORT=6379Note: The .env file should not be committed to version control.
After configuring Redis, verify the connection:
Look for this log message on startup:
[Cache] Redis connected
If Redis is not available, you'll see:
[Cache] Redis error: Error: connect ECONNREFUSED
Use the monitoring endpoint to check cache statistics:
# Using curl
curl http://localhost:3000/api/trpc/monitoring.cacheStats
# Expected response
{
"hits": 0,
"misses": 0,
"hitRate": 0,
"sets": 0,
"deletes": 0,
"errors": 0
}# Connect to Redis
redis-cli -h your-redis-host.example.com -p 6379
# Test connection
redis> PING
PONG
# Check keys
redis> KEYS *
(empty list or list of keys)The caching layer uses the following TTL (Time To Live) values:
| Data Type | TTL | Hit Rate (Expected) |
|---|---|---|
| Users | 1 hour | 80-90% |
| Jobs | 5 minutes | 60-70% |
| Job Results | 10 minutes | 70-80% |
| Sessions | 24 hours | 90-95% |
On startup, the application pre-loads:
- 100 most recent users
- 200 most recent jobs
This ensures high hit rates immediately after deployment.
- Throughput: 20-30 requests/second
- Latency: 50-100ms (database queries)
- Hit Rate: 0% (no caching)
- Throughput: 1,000+ requests/second (50x improvement)
- Latency: <1ms (cache hits)
- Hit Rate: 80-90% (for stable data)
For a typical workload with 1,000 user requests:
- Without Redis: 1,000 database queries × 50ms = 50 seconds
- With Redis: 100 database queries × 50ms + 900 cache hits × 1ms = 5.9 seconds
Result: 8.5x faster response time
If Redis is unavailable, the application will:
- ✅ Continue to work (no crashes)
- ✅ Fall back to database queries
⚠️ Lose 10x throughput improvement⚠️ Experience higher latency (50-100ms vs <1ms)
The circuit breaker will detect Redis failures and automatically fall back to database queries.
Monitor cache performance using the monitoring endpoint:
curl http://localhost:3000/api/trpc/monitoring.cacheStatsTarget Hit Rates:
- Users: 80-90%
- Jobs: 60-70%
- Sessions: 90-95%
If the Prometheus + Grafana monitoring stack is deployed, view the Cache Performance Dashboard:
- Cache hit rate over time
- Memory usage
- TTL distribution
- Cache operations (hits, misses, sets, deletes)
Access at: http://localhost:3001 (default Grafana port)
Cause: Redis is not running or not accessible at the configured host/port.
Solutions:
- Verify Redis is running:
redis-cli -h $REDIS_HOST -p $REDIS_PORT ping - Check firewall rules allow connections to Redis port
- Verify
REDIS_HOSTandREDIS_PORTare correct - Check Redis authentication if required
Cause: Redis is not configured or cache is being cleared frequently.
Solutions:
- Verify Redis environment variables are set
- Check application logs for Redis connection errors
- Verify cache warming is running on startup
- Check if cache is being cleared by admin operations
Cause: Too many cached entries or TTL values too long.
Solutions:
- Reduce TTL values in
server/_core/cache.ts - Implement cache eviction policies (LRU, LFU)
- Increase Redis memory limit
- Clear cache manually:
curl -X POST http://localhost:3000/api/trpc/monitoring.cacheClear
If Redis is not available in your environment, you can disable caching to avoid error logs:
# Use localhost (will fail gracefully)
REDIS_HOST=localhost
REDIS_PORT=6379The circuit breaker will detect the failure and fall back to database queries.
Edit server/_core/index.ts and comment out cache warming:
// await warmCache(); // Disabled - Redis not available- Configure Redis: Set
REDIS_HOSTandREDIS_PORTenvironment variables - Verify Connection: Check application logs for
[Cache] Redis connected - Monitor Performance: Use
monitoring.cacheStatsendpoint to track hit rates - Optimize TTL: Adjust TTL values based on production metrics (see
CACHE_OPTIMIZATION_GUIDE.md) - Deploy Monitoring: Set up Prometheus + Grafana for real-time cache performance dashboards
- Redis Caching Guide - Detailed caching implementation
- Cache Optimization Guide - TTL tuning and optimization strategies
- Monitoring Stack - Prometheus + Grafana deployment
Version: 1.0.0
Last Updated: 2025-11-14
Status: Redis not configured (defaults to localhost:6379)