Redis
The Redis Troubleshooting page provides quick guidance to help you identify and resolve common issues when using the Redis service on FPT Cloud. This section focuses on frequently encountered problems such as connection errors, configuration issues, performance degradation, backup/restore failures, and Redis-specific scenarios.
Each topic includes clear descriptions of symptoms, root causes, and recommended resolutions, enabling you to perform initial troubleshooting or work effectively with the technical support team.
The goal of this document is to help you operate Redis in a stable, secure, and efficient manner while minimizing service disruption during incidents.
Error list:
1. Connection error: Server closed the connection
1.1. Symptoms
When a client application connects to Redis, the following error may occur:
Redis error: Server closed the connection
This happens when the Redis connection is unexpectedly terminated during processing. The application may experience timeouts or repeatedly attempt to reconnect.
1.2. Root Cause
This error occurs when the Redis server proactively closes the connection with the client. Common causes include:
- Unstable network between the application and Redis.
- Redis resource overload (CPU, memory, or number of connections)
- Improper connection configuration in the application
- Interference from firewall or network devices (e.g., NAT, Load Balancer) that terminate connections
1.3. Impact
When this error occurs, the system may be affected in the following ways:
- Temporary disruption in data processing: Requests relying on Redis (cache, session, queue) may fail
- Increased application latency: Due to retries or connection re-establishment
- Temporary data loss: Data not successfully written to Redis may be lost
- Overall performance degradation: The application may fall back to the database or reprocess logic
- In some cases, it may cause cascading failures, especially if Redis is used as a critical component (e.g., session store, message broker).
1.4. Resolution and Recommendations
Step 1: Verify network connectivity
Ensure the application can connect to Redis:
redis-cli -h -a -p ping
If PONG is not returned, check network connectivity or access configuration.
Step 2: Monitor Redis performance
Enable monitoring and review Redis performance via the monitoring dashboard (see section Monitoring for details). At minimum, monitor:
- CPU and memory usage
- Number of connections
- Response time
Step 3: Verify application connection configuration
Parameter names and configurations vary depending on the Redis client. However, ensure the following functional configurations are properly set:
- Connection health check → Detects broken connections and proactively re-establishes them. (e.g., health_check_interval in redis-py)
- TCP keepalive → Prevents connections from being closed due to network or intermediary timeouts. (e.g., socket_keepalive in redis-py)
- Retry on timeout → Automatically retries requests when a timeout occurs. (e.g., retry_on_timeout in redis-py)
- Retry on error → Automatically retries when transient errors occur (e.g., connection drops, server-closed connections). (e.g., retry_on_error in redis-py)
Refer to your Redis client documentation for exact configuration details:
- ioredis: https://github.com/redis/ioredis/blob/main/lib/redis/RedisOptions.ts
- redis-py: https://github.com/redis/redis-py/blob/master/redis/connection.py
- django-redis: https://github.com/jazzband/django-redis
- keyv/redis: https://keyv.org/docs/storage-adapters/redis/
- node-redis: https://github.com/redis/node-redis/blob/master/docs/client-configuration.md
Step 4: Check firewall and network devices
If there are firewalls or intermediary devices between the Application subnet and Database subnet:
- Review firewall logs to detect dropped or terminated connections
- Ensure there are no abnormal timeout or connection limit settings
- Monitor network traffic for instability or interruptions
Refer to Redis document: https://redis.readthedocs.io/en/stable/connections.html
Recommendation:
- Use connection pooling and enable keepalive to reduce connection drops
- Set up monitoring and alerting for Redis
- Implement retry mechanisms in the application layer
- Regularly review network and firewall configurations to ensure stable connectivity.