advancedTop 30 Scenario-Based Questions
Design a session management system for a web application handling 100,000 concurrent users.
Redis is the perfect fit: 1) Session data: HSET session:{sessionId} userId 42 role ADMIN lastActivity 1234567890. 2) TTL: EXPIRE session:{sessionId} 1800 (30 min idle timeout). 3) Reset on activity: EXPIRE session:{sessionId} 1800 on every request. 4) Lookup: HGETALL session:{sessionId} on each request. 5) Invalidation on logout: DEL session:{sessionId}. 6) Scale: Redis Cluster with 3 masters (300
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response