What it costs one engineer to run a Next.js job platform on Cloudflare, priced line by line at list price over 89 days: $9.48 a day. Which fixes cut the cost per request, and how sampled analytics sent me after a problem I never had.

I run lokerdollar.com alone: a Next.js job platform on Cloudflare Workers, built with OpenNext, with D1, KV, R2, Durable Objects and Workers AI behind it. I priced every production line item per day for 89 days (6 Sep – 3 Dec) at Cloudflare's public list price. Here is what it costs, which fixes worked, and the one that fixed nothing.

The numbers:

  • $9.48 a day for production, 89-day average, list price
  • 126k → 236k main site Worker requests a day
  • $74 → $46 list-price cost per 1M Worker requests
  • 0.01% 5xx error rate at the edge, last 30 days

A caveat on requests: they are the main site Worker's invocations from Cloudflare's analytics. They include the site's own page regeneration fetches and automated test runs against the live site, and the analytics count more than billing does (33.5M against 22.4M billed, account-wide, for 27 Oct – 26 Nov). Bots are included and I have not separated them. A second count, PostHog web-vitals events (also not filtered for bots), about doubled over the same months too (1,668 a week in September, 3,368 in mid-November).

The bug my dashboards showed me

On 18 November my analytics showed most cache keys written 2, 4, 6 or 8 times a day, with odd counts a tenth as often. In a spot check of 9 keys, each key's writes landed in the same second. It looked like every concurrent request writing its own copy of a cache entry: a classic race, and an expensive one, because cache writes are my biggest production line.

On 19 November I shipped a fix that dropped duplicate writes. Before deploying it I set a pass bar: at most 4 writes per key per day, down from 5.9.

At the readout on 21 November the figure was 6.07, with the same even-number pattern. Then I looked wider. Reads showed the same pattern, and so did buckets written by code that has nothing to do with the cache. The R2 analytics dataset is sampled: one sampled event comes back as a weighted count of 2, 4, 6 or 8. Cloudflare documents the sampling, and its write totals over a billing period match the bill within 1%, but per-key counts do not. The evidence for a race was an artifact of sampling. I reverted the fix.

Before you optimise a single key, query or object, check whether the dataset you are reading is sampled. Only the totals are safe to act on.

Missing the bar is what made me look again. Total writes had fallen 27% after the deploy, but only because fewer keys were written that day. On its own that drop would have read as success, and my written plan for a miss was a bigger change in the callers.

What it costs: requests nearly doubled, cost per request fell 38%

Production averaged $9.48 a day over the 89 days: $6 to $12 a week on average, $5 to $17 on single days. Over the same months the main site Worker went from 126,000 to 236,000 requests a day.

I cannot split the 38% fall cleanly between the fixes and the traffic growth. Counted as plain savings per day, the two biggest fixes (KV and cache writes) explain about a sixth of it. Counted at September's writes per request, they explain about three quarters. The rest is cost that does not grow with traffic (scheduled jobs, job ingestion) spread over more requests, plus D1 reading about half as many rows per request.

Per month, September → October → November:

  • Production $/day: 9.38* → 8.10* → 10.84† (+16%)
  • Worker requests/day: 126k → 150k → 236k (+86%)
  • $ per 1M Worker requests: 74.17* → 54.03* → 46.01† (−38%)
  • D1 rows read per request: 7,796 → 6,694 → 4,028 (−48%)
  • KV writes/day: 359k → 135k → 128k (−64%)
  • Cache writes (R2 Class A)/day: 605k → 440k → 674k† (+11%)
  • CPU ms per request: 285 → 271 → 419 (+47%)

September counts from the 6th (the start of the 90-day API window). * September is missing Workers AI for 21–30 Sep (about $3 per million, so September is a little low), and October for 1–13 Oct. Cloudflare billed $111.80 of Workers AI for the billing period 27 Sep – 26 Oct against $28.16 in this series for 1–26 Oct, so October cost could be about $18 per million requests higher. † Includes test-environment writes to the same bucket, about 12.5% of its writes in late October and 28–38% in mid-November, so November cost and cache writes are overstated, by roughly $0.85 to $1.15 a day.

Cloudflare billable usage, daily cost by product, 27 Oct to 26 Nov 2026
Cloudflare's billing page, 27 Oct – 26 Nov: $363.22. Cropped to the chart, not otherwise edited, container products removed in Cloudflare's own filter. This is billable cost after free allowances and still includes test environments; the production-only figures above remove those.

Cloudflare zone analytics, last 30 days: 10.63M requests, 2.24M visits, 32.20% cache hit rate, 0.01% 5xx
Zone analytics, last 30 days (4 Nov – 4 Dec): 10.63M requests, 0.01% 5xx. This counts every request at the edge, including static files and cache hits, so it is higher than the Worker count above.

Three lines to check if you run Next.js on Cloudflare

1. Cache writes cost as much as compute

R2 Class A operations on the Next.js incremental cache cost $3.30 a day over the last two weeks, against $2.19 for the main Worker's CPU. That R2 figure still includes test environments writing to the same bucket, 28–38% of its writes when I measured in mid-November; without them it is about $2.05 to $2.40, level with CPU.

On a server-rendered site with ISR, a cache entry is written each time a page is regenerated, so the line grows with the number of distinct pages crawled, not the number of users. On 5 October I fixed two cache keys: a job-count key that carried a timestamp finer than an hour (now floored to the hour), and per-user lookups that missed the cache on every request (now held in memory for 60 seconds). Writes fell from about 900,000 a day in late September and early October to about 400,000 a day after the fix. They have grown again since, partly from traffic and partly from test environments. Per request they are about 40% below September's average, though some of that is simply more requests.

Cloudflare billing, R2 Class A operations only, daily cost, 27 Sep to 26 Oct 2026
R2 Class A, 27 Sep – 26 Oct: $54.00. Cloudflare bills Class A in steps of $4.50 per million, so each bar is a day the account crossed another million writes. The bars come further apart after 5 Oct.

2. The page-regeneration queue bills the time it spends waiting

OpenNext uses a Durable Object to queue page regeneration. Durable Objects are billed on wall-clock duration, so each regeneration bills for the full time the object waits for the page to render: about 15.7 seconds on average in October, across roughly 22,600 regenerations a day. That line is (number of regenerations) × (render time). Making slow pages render faster cuts it directly, and so does regenerating fewer long-tail pages.

Cloudflare billing, Durable Objects compute duration only, daily cost, 27 Oct to 26 Nov 2026
Durable Objects duration, 27 Oct – 26 Nov: $37.50 account-wide, billed in steps. Of the 2.78M GB-seconds in that period, 1.91M (69%) was the production page-regeneration queue.

3. A known trap I still fell into: a KV write on every flag check

In September, KV writes cost $0.90 to $4.10 a day, a quarter of production cost on the worst days. The cause was a last-known-good copy of my feature flags, written back to KV every time the server evaluated a flag. On 5 October I skipped the write when the value had not changed and the last write was recent. Changed values still write at once. KV writes went from 359,000 a day in September to 135,000 in October.

Writing on every read is a well-known way to run up a KV bill, and I did it anyway. KV writes cost 10 times more than reads, so check any code path that writes on read.

Cloudflare billing, KV write operations only, daily cost, 27 Sep to 26 Oct 2026
KV writes, 27 Sep – 26 Oct: $20.00, down from $40.00 the month before. Billed in $5 steps per million writes; after the 5 Oct fix, one more million in three weeks.

What I still do not know

CPU per request went up by half, and I do not know why yet. Between 1 and 3 November, CPU time per request on the main Worker went from about 270 ms to about 440 ms, while requests went from about 155,000 to 294,000 a day. It has not come back down. Requests and CPU per request jumped on the same days, which points to a change in what was being requested rather than slower code. Two candidates fit and I have not told them apart: my own traffic (page regeneration after deploys and automated test runs, both counted in these requests), or crawlers and bots reaching heavy pages that are not cached. Either way, part of the 86% request growth is not people.

The average hides the shape. Cloudflare's metrics for the last 30 days put median CPU time at 126 ms, with the 99th percentile at about 3 seconds. A small share of very slow requests is pulling the average up, so that tail is where I am looking first.

Cloudflare Workers metrics for the main site Worker, CPU time percentiles over the last 30 days
Main site Worker CPU time, last 30 days: P50 126 ms, P90 about 1 s, P99 about 3 s.

I keep only 10% of logs, and cannot prove nothing is missed. I cut my tail Worker's log sampling from 100% to 10%. In the next 24 hours it still forwarded 22 error events across 13 distinct issue groups, with the longest gap between events about 4.9 hours. I have no unsampled day to compare against, so rare error groups may have been missed. For me the 90% cut in log volume was worth that risk.

Page speed did not get a step change, and it is still not good. Largest Contentful Paint at the 75th percentile, from browser measurements in PostHog (all sessions, bots and test accounts not filtered), stayed between about 2.6 and 3.8 seconds a week, with no step change after any of the cost changes. It stayed above Google's 2.5-second "good" mark, and it has crept up since mid-November (2.58 to 2.95 seconds a week).

The routine, for anyone running this stack alone

  1. Price usage at list, per product, per day. The billing page shows what you pay after allowances. List price shows what each line is worth, and it does not change if your plan or discounts do.
  2. Divide by requests. A total that rose 16% while requests rose 86% is a cost per request that fell 38%. Without the denominator you cannot tell a fix from a quiet week.
  3. Write the pass bar down before the deploy, and when the change misses it, check your measurement before building more. That is how I found the bug that did not exist.
  4. Check whether the dataset is sampled before acting on any per-key, per-query or per-object number.
  5. Look for writes on read in KV, R2 and every cache, and for anything billed on wall-clock time.

How these numbers were made

Cloudflare GraphQL Analytics API, read-only, one query per dataset per day, split by Worker script, D1 database, KV namespace, R2 bucket, Durable Object namespace and AI model, collected 4 December 2026. Each resource over $1 was classed as production or test from its name and ID; preview Workers, per-run preview databases and CI-only resources were removed. Usage × Cloudflare's public Workers Paid list price, before the monthly free allowances and the $5 plan fee: what the usage is worth at list price, not an invoice.

For the billing period 27 Oct – 26 Nov, my summed usage matched Cloudflare's billing page within 2% on 11 of 12 lines (Workers CPU 6.215B vs 6.21B ms, D1 rows read 32.13B vs 32.09B, R2 Class A 20.38M vs 20.37M). Request counts did not match: 33.5M in the analytics against 22.4M billed. The analytics datasets are sampled, so daily figures are estimates, and Workers AI is missing for 21 Sep – 13 Oct (see the note under the monthly figures). Workers AI has no per-model data before 3 November and is assumed to be all production. Test builds writing to the shared cache bucket are counted as production, so November's cost and the +16% are overstated. Filling that gap would raise September, not November, so the 38% drop would get slightly larger, not smaller.

I build lokerdollar.com, where companies hire Indonesian talent for any role, with free hiring tools. Production runs at about $9 to $11 a day at list price, before test and CI environments. Keeping it there is part of how one person keeps the site running.

I also help engineering teams move from vibe coding to agentic coding: agents open the pull requests, CI gates them, and the cost numbers are measured like the ones above. If your team is working on that, or on its cloud bill, reach out on LinkedIn.

How do you check whether a cost fix worked? Tell me what you measure.