Performance: Why sessions manage user state
MEDIUM IMPACT
This concept affects how quickly user-specific data is accessed and maintained across page loads, impacting interaction responsiveness and server load.
Using Flask's secure session cookies with minimal data and server-side session store with expiration and cleanup.Storing user state only in client-side cookies without server validation or using large session data stored in server memory without expiration.
| Pattern | Data Size Sent | Server Memory Use | Response Delay | Verdict |
|---|---|---|---|---|
| Large client-side cookies | 40-50kb per request | Low | High (100ms+) | [X] Bad |
| Server-side sessions with expiration | Minimal (cookie only) | Moderate but controlled | Low (50ms) | [OK] Good |