Description
Under high traffic scenarios (100+ concurrent users), Redis connection pool exhaustion occurs, causing WebSocket connection failures and memory leaks.
Steps to Reproduce
- Load test with 100+ concurrent WebSocket connections
- Monitor Redis connection count
- Notice connections increasing without being released
- After ~30 minutes, new connections fail with "Connection pool exhausted"
Expected Behavior
Redis connections should be properly pooled and released. Consumer instances should not hold references after disconnection.
Root Cause
WebSocket consumers don't properly clean up Redis channel layer connections on disconnect. The disconnect() method doesn't always execute, and connection pool settings are too low.
Files to Fix
- linkup/messaging/consumers.py - Ensure proper cleanup in disconnect() with try/finally
- linkup/messaging/connection_recovery_manager.py - Fix connection pool reuse
- linkup/professional_network/settings/base.py - Increase CHANNEL_LAYERS connection pool size
- Add connection pool monitoring
Acceptance Criteria
Description
Under high traffic scenarios (100+ concurrent users), Redis connection pool exhaustion occurs, causing WebSocket connection failures and memory leaks.
Steps to Reproduce
Expected Behavior
Redis connections should be properly pooled and released. Consumer instances should not hold references after disconnection.
Root Cause
WebSocket consumers don't properly clean up Redis channel layer connections on disconnect. The disconnect() method doesn't always execute, and connection pool settings are too low.
Files to Fix
Acceptance Criteria