StoicBuilder
Later missionMission 43: The 1st of the monthYou can practise it now. It counts once you reach mission 43, after “Yesterday's price”.Back to HQ
Exit lesson
Queues and workersProLesson 38 of 45, about 8 min
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
0 XP

The app: Beacon, logs, metrics and traces

Beaconharbor-billing1st of the month, 09:00
PDF drawn in the request

Nothing run yet. 750 teams will ask for last month’s invoice in the next few minutes.

The code, the queue and the job log

route.js the code that runs
1// app/api/invoices/[id]/pdf/route.js2export async function GET(req, { params }) {3 const { id } = await params;4 const invoice = await db.invoices.find(id);5 const pdf = await renderPdf(invoice); // 3 to 9 s, while the request waits6 return new Response(pdf, { headers: { "content-type": "application/pdf" } });7}
Queue: invoice-pdf after the rush

No queue yet. Each PDF is drawn while its request waits.

The MagisterIt’s 09:00 on the 1st, and 750 teams want last month’s invoice as a PDF. Right now the PDF is drawn inside the web request, which takes 3 to 9 seconds. Run the rush and watch the whole app, not only the invoices.

Step 1 of 7Run the month-end rush
  • Run the rush
  • Tap the downloads that timed out
  • Tap the login p95

You’re not signed in, so this lesson won’t be saved to your path. Sign in free to keep your XP.