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
API and worker modules
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.