Performance: Session data storage
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by how session data is stored and accessed during requests.
from flask import session # Store only a small user ID in session cookie session['user_id'] = user.id # Retrieve full user data from server-side cache or database as needed
from flask import session # Storing large data directly in client-side cookie session session['user_data'] = large_user_object # This stores all data in cookie, sent with every request
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large client-side session cookie | Minimal | 0 | Low but delayed by network | [X] Bad |
| Small client-side session cookie + server data fetch | Minimal | 0 | Low and fast | [OK] Good |
| Server-side session with Redis | Minimal | 0 | Low and fast | [OK] Good |