Inkwell's PDF exports are back, and bigger: every export is now rendered as a finished book, about 400 ms of CPU each. Writers don't need the PDF instantly; they need the app to say "we're on it" and the file to arrive a moment later. About 2% of renders fail and have to be tried again.
What it does
- Read: a user opens a note.
- Write: a user asks for a PDF export, which has to be rendered and saved.
Workload
A steady 1 000 rps for 30 seconds, 95% reads / 5% exports, against 10 000 notes. That's 50 exports a second.
How to build it
The app servers and the database are fixed. Exports go through a message queue to workers, which render each one and save it to the database. You choose the queue's settings and the workers' tier and instances.
- Build the path for reads: client, load balancer, app server, database.
- Send writes from the app server to a queue, connect the queue to a worker, and the worker to the database.
- Size the workers so exports are ready in seconds, for as little as you can. A job that fails its last attempt is lost, so give the queue enough attempts.