Sharpen your edge-computing vocabulary covering Cloudflare Workers, KV, R2, and Durable Objects.
0 / 5 completed
1 / 5
In a PR, a reviewer asks why you're using KV for session data instead of R2. The architectural reason is:
Cloudflare KV is a globally replicated key-value store optimised for small values with low-latency reads. R2 is S3-compatible object storage suited for large blobs like images or archives.
2 / 5
A standup ticket: the Worker crashes with No object named 'MY_BUCKET'. What must be added to wrangler.toml to bind R2?
R2 buckets are exposed to Workers via [[r2_buckets]] in wrangler.toml, specifying binding = "MY_BUCKET" and bucket_name. The binding becomes an object on the Worker's env.
3 / 5
During code review, your team debates using Durable Objects vs KV for a real-time collaborative counter. The deciding factor for Durable Objects is:
Durable Objects give you a single-instance actor with strongly-consistent, transactional storage — ideal for coordination, counters, or collaborative state. KV is eventually consistent and not suited for concurrent writes.
4 / 5
A teammate's Worker returns stale data after an update. She used await env.MY_KV.put(key, value) but didn't set a TTL. In a code review, you note that KV reads can be stale because:
Cloudflare KV is eventually consistent. After a put(), edge caches may serve the old value for up to ~60 seconds. For strong consistency, use Durable Objects.
5 / 5
In a design review, you propose streaming a large file upload directly into R2 from a Worker using env.BUCKET.put(key, request.body). A colleague asks what request.body is in this context:
request.body is a ReadableStream. Passing it directly to R2.put() streams the upload without buffering the entire file in the Worker's memory.