Performance: JWT vs session strategy
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by influencing server requests, token size, and client-side processing.
Using JWT stored in HTTP-only cookies with minimal server validation.Using server sessions with frequent server lookups on every request without caching.
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Server session with frequent lookups | Low | Multiple per request | Medium | [X] Bad |
| JWT with large payload | Low | Few | High due to parsing | [!] OK |
| JWT with minimal payload | Low | Few | Low | [OK] Good |
| Server-side session validation with SSR | Low | Single | Low | [OK] Good |