Our health check was measuring the wrong path
One failed check on our status page led us to background work running far from the backends it calls. Moving it next to them made health checks eight times faster and cut async render time.
- performance
- infrastructure
- monitoring
Every 5 minutes, the PageRush status page renders a real PDF with Typst in each region, through the same compile service your API calls use. On 13 November 2026 at 04:50 UTC, one of those checks failed. It was the only failure in four days. Looking into it turned up something more useful than the failure itself: the check had been measuring a path that customers' synchronous renders never take.
One check that got no answer
The failed check got no response within its 15 second limit. The checks 5 minutes before and after it were normal, and so was the hour that followed.
The compile service's own logs settled where the time went. It was running and warm at 04:50, and it handled a different request 18 seconds later in about 6 ms. The health check's request never appears in those logs at all. It stalled somewhere on the network between our API and the compile service, and the 15 second limit cut it off.
A single network stall is not something you can fix. But the logs showed something else.
6 ms of compiling, a second of waiting
The compile service finished each health check in 5 to 7 ms. The health check itself usually recorded 0.7 to 1.5 seconds. Almost all of that was the trip to and from the compile service.
That should not happen. In an earlier post we explained that the API runs with a fixed placement in Mumbai, right beside the compile service. Our production data agreed for synchronous renders: across 3,425 of them, the time measured on our side averaged 74 ms. Asynchronous renders, the ones that deliver the PDF to a webhook, told a different story. They averaged about 1.5 seconds, far more than storing the PDF (which only they wait for) could explain.
Placement applies to requests, not to everything
The API runs on Cloudflare Workers. A Worker handles incoming HTTP requests, and it can also run on a schedule and consume messages from a queue. Our health check runs on the schedule. Asynchronous renders run from the queue.
Cloudflare's documentation is direct about it: placement "only affects the execution of fetch event handlers". Scheduled and queue handlers are not placed. They run in whichever data centre Cloudflare starts them in, which can be far from Mumbai, and each call to the compile service and the database from there crosses that distance.
So synchronous renders ran in Mumbai, and everything in the background did not. Our health check sat in the second group, which meant the status page was measuring a path that synchronous renders never take.
The fix: send the work to ourselves
Since placement applies to HTTP requests, the scheduled and queue handlers now make one. The Worker has a service binding to itself, and the background handlers use it to pass their work to the Worker's own request handler. That request is placed like any other, so the work runs in Mumbai.
These internal requests are signed, with the signature covering the path, the time and the body. An unsigned, stale or altered request gets the same "not found" as any unknown address.
There are two safety rules. If the internal call is refused before any work starts, the job runs where it is, slower but never skipped. If it fails partway through, the queue message goes back on the queue. That is already safe, because every job records its own state and a redelivered job checks it before doing anything.
What changed
We tried it on our staging environment first and checked the placement header on every internal call. Each one ran in Mumbai.
| Before | After | |
|---|---|---|
| Health check, staging average | 951 ms (72 checks) | 112 ms (17 checks) |
| Health check, production | usually 0.7 to 1.5 s | 76 ms and 68 ms, the first two checks |
| Async render, including storing the PDF | about 1.5 s | 300 to 370 ms on staging |
Synchronous renders were already placed, so they did not change. The status page now times the same path they use.
Lessons
Check where your background work runs. Placement settings, regions and affinity rules often apply to one kind of entry point and not to another. Read that boundary in the documentation rather than assuming the whole service moved.
Make the health check take the customer's path. A check that goes a different way can be wrong in either direction: it can look healthy while customers suffer, or slow while they are fine. Ours looked slow while synchronous renders were fast.
Read the logs on both ends. Our side of the call recorded a timeout. The compile service's side recorded nothing at all, and that absence is what said "network" and not "compiler".