R2 + Worker Runtime
How R2 and Worker form the core query path.
R2 + Worker Runtime
Core idea
The Worker does not fetch the whole object. It asks R2 only for the byte ranges it actually needs.
Why is that interesting?
- the amount of transferred data becomes smaller
- known query paths can be optimized very precisely
- runtime logic can stay at the edge close to the request
What does the Worker do?
In practice the Worker acts as a query planner and response assembler:
- interprets the request
- selects the required range reads
- assembles the response from them
End-to-end path
HTTP request
-> worker.js
-> queryJdbinTop(...)
-> R2 range reads
-> DataView decode
-> JSON response with rows + metricsWhy Cloudflare specifically?
Cloudflare provides the primitives this architecture needs:
- Worker
- R2
- byte-range reads
- edge execution
Important boundary
The Worker is not just an API proxy. It acts as planner, range reader, parser, and response builder.