Note · budding
Counting D1 rows before the bill
- Stage
- budding
- Links
- 1 out, 1 in
Inbound Outbound runs on Cloudflare: a Worker for the API, D1 for data, a Durable Object that pushes live changes to open screens, Queues for webhooks and connector pulls, and cron. On 14 November 2026 I had every route, screen and scheduled job costed in D1 rows read, Worker requests, Durable Object requests and queue operations. The counts come from the code and from EXPLAIN QUERY PLAN on a copy of the local database. The totals are estimates from stated assumptions. None is measured on a deployed Worker.
The first limit is rows read
One site with 14 open screens would pass the Paid plan’s 25 billion rows read a month within its first month. Two queries caused it: the event list read every event of the organisation, and the yard view read every visit the site has had. Both ran on every live message and every poll.
What changed
- The event list filters on the site and reads only the rows it returns.
- The yard view loads docks, open visits, today’s visits and carriers in one batch of four indexed statements.
- A tab holds one WebSocket. Each screen refetches only on the message types it uses.
- A truck’s position on the road is answered with 4 statements, down from 11.
- Timestamps such as
last_seen_atare written at most once an hour. head_sampling_ratefor traces is 0.1.- Each cron step runs in its own
try, and the purges run once an hour before the no-show step.
The Free plan
The Workers Free plan allows 5 cron triggers, counted across the account. The Worker had two, a */5 one and a nightly one, and wrangler deploy failed while updating triggers. The nightly timing job now runs from the single */5 * * * * cron, at the first tick at or after 03:15 UTC.
The PDF reports compile LaTeX with Tectonic, which needs a container, and Containers needs the Paid plan. The compiler is a separate public repository, tectonic-pdf-service. The API answers 501 for a PDF until PDF_ENABLED is on, and CSV, JSON and LaTeX output work without it.
The cost page in the repository ranks the changes and lists what each one saves.
Projects
- Inbound OutboundA multi-tenant SaaS for booking vehicles into a warehouse and calling them to a dock, built on Cloudflare in three days as a test of building real full-stack cloud applications.
Projects
- Inbound OutboundA multi-tenant SaaS for booking vehicles into a warehouse and calling them to a dock, built on Cloudflare in three days as a test of building real full-stack cloud applications.