Design a session store for a global website
Apply key-value replication to short-lived data where reads dominate and a logout must not be undone by replication.
The brief
A global website keeps a session record for each signed-in browser: user ID, roles, and expiry. Every authenticated request reads it. Sessions expire after inactivity, and a logout must take effect in every region within seconds. Losing a session is an annoyance, since the person signs in again; honoring a revoked one is a security problem. Keep password checks, multi-factor login, and account recovery outside this exercise.
- 30 million people sign in each day. Each makes 200 authenticated requests a day, and each request needs its session once. Use decimal units and 86,400 seconds per day.
- Peak traffic is 3 times the daily average. There are 3 regions, and the busiest carries 50% of traffic at peak.
- Each person creates one session a day, and a session's expiry is refreshed at most once every 10 minutes while in use, about 6 refreshes per person per day. There are 10 million logouts a day.
- A session expires 24 hours after its last use, giving about 1.5 live sessions per daily user. A session is 1 KB and a revocation record is 100 bytes. Plan 3 copies in each region. A store node holds 32 GB of session data and serves 100,000 reads per second.
- Session checks must finish within 10 ms at p99 in the local region, and the farthest regions are 150 ms apart. A logout must take effect everywhere within 5 seconds in normal operation.
Reading a design isn’t the same as producing one under a clock. Try it timed: the requirement change stays hidden until partway through.
Loading your draft…
State your scope. Estimate average and peak session checks, the busiest region's peak, peak writes, live-session storage per region with copies, and the size of a day of revocation records. Keep units visible.
0 / 4,000 charactersName the components and what each stores. Trace a sign-in, an authenticated request, and a logout. Choose W and R within a region, and say how data crosses regions.
0 / 4,000 charactersExplain what stops a delayed expiry refresh from undoing a logout, and how long deletion records must be kept. If a network partition cuts off a region, say whether it keeps accepting sessions it cannot check, and for how long.
0 / 4,000 charactersRespond to the log-out-everywhere change below. Name the data you add, what each request now does, and one cost of your approach.
The requirement changesAfter a password reset or suspected account takeover, security now requires revoking all of a person's sessions in every region within 5 seconds. Most people have one or two sessions, but some have dozens. Sessions are keyed by session ID, so the store cannot list a person's sessions. What do you add, and what does it cost on each request?
0 / 4,000 charactersWrite an initial response in all four sections to unlock the checklist and two worked approaches.
Get critiqued, or get interviewed
SystemKit doesn’t read your answers: they stay in this browser. To get feedback from an AI, copy one of these prompts into a chatbot you already use. Treat what it says as a second opinion, and check anything that sounds too confident.