A session costs a lookup on every request but can be revoked at once; a signed token needs no lookup, so the server cannot take it back before it expires.
Learn the idea first
Ana signs in to shop.example on her laptop, then opens her orders page twice. The browser is a fixed 40 ms round trip from the servers; the slider sets how far the servers are from the session store (1 ms is the same data center, 60 ms or more is another region). Timings are an illustrative model.
Browser
Ana's laptop
Auth server
checks passwords
App server
shop.example
Session store
Redis
Swipe the diagram sideways to see every column →
Where the time goes
203 ms total
Ana signs in to shop.example on her laptop, then opens her orders page twice. The browser is a fixed 40 ms round trip from the servers; the slider sets how far the servers are from the session store (1 ms is the same data center, 60 ms or more is another region). Timings are an illustrative model.
Illustrative timings. Real numbers vary with distance, network quality and server load.