System Design Atlas

Timed examination platform

06 / 10Worked example

The overall architecture

Why do the worker and API share the same datastore?

User submission and automatic completion modify the same business state in separate processes.

Starting point Both change V-17.

Assumptions for the example case

Illustrative design: 50,000 attempts per day, 10,000 simultaneous starts, a 90-minute duration, autosave every 10 seconds and a peak of 1,000 answer writes/s. This gives at most 540 save opportunities per attempt open for the full duration; actual writes depend on changes and batching.

Runtime architecture

The API and worker coordinate concurrent changes through the relational datastore.

API and worker modules

Attempt management, answer storage and deadline completion remain identifiable.

Boundaries

API-Commit
Autosave and participant submission check the role, version, state and receivedAt.
Worker-Commit
Automatic submission checks the stored closesAt, state and version.

Terms in this step

Deadline Worker
Repeatably implements a stored time rule.

Try it yourself

Assign autosave and automatic submission to their respective processes.

A hint for your attempt

The transaction remains completely in one process.

Compare with a possible solution
API
Saving answers and participant submission.
Worker
Completion after the deadline.

Apply to your project

Draw the boundary for a reservation deadline.

Sequences show contention at the deadline.