Cloudflare Docs
Workers
Visit Workers on GitHub
Set theme to dark (⇧+D)

Storage options guide

The Cloudflare Workers platform provides multiple storage options. This guide will inform you on which storage option is appropriate based on your project’s use case.

​​ KV

Workers KV is an eventually consistent key-value data store that caches on the edge.

It is ideal for projects that require:

  • High volumes of reads and/or repeated reads to the same keys.
  • Per-object time-to-live (TTL).
  • Asset storage for websites.

To get started with KV:

​​ R2

R2 is S3-compatible blob storage that allows developers to store large amounts of unstructured data without egress fees associated with typical cloud storage services.

It is ideal for projects that require:

  • Storage for files which are infrequently accessed.
  • Large object storage.
  • Strong consistency per object.

To get started with R2:

​​ Durable Objects

Durable Objects provide low-latency coordination and consistent storage for the Workers platform through global uniqueness and a transactional storage API.

  • Global Uniqueness guarantees that there will be a single instance of a Durable Object class with a given ID running at once, across the world. Requests for a Durable Object ID are routed by the Workers runtime to the Cloudflare data center that owns the Durable Object.

  • The transactional storage API provides strongly consistent key-value storage to the Durable Object. Each Object can only read and modify keys associated with that Object. Execution of a Durable Object is single-threaded, but multiple request events may still be processed out-of-order from how they arrived at the Object.

It is ideal for projects that require:

  • Real-time collaboration (such as a chat application or a game server).
  • Consistent storage.
  • Data locality.

To get started with Durable Objects:

​​ Comparison

FeatureKVR2DO
Maximum storage per accountUnlimited1Unlimited50 GiB
Storage grouping name2NamespaceBucketDurable Object
Groups per account1001,000Unlimited
Maximum keys per groupingUnlimitedUnlimitedUnlimited
Maximum key size512 bytes1,024 bytes2,048 bytes
Maximum metadata per key1,024 bytes2,048 bytesN/A
Maximum size per value25 MiB5 TiB128 KiB per value
Consistency modelEventualStrongTransactional for multiple keys in a single DO
CachedAlwaysProgramatically using the Worker Cache API or configure a custom public bucket domain.Possible when using Cache API
S3-compatible APINoYesNo
TTL expirationObject-levelNot currently availableNot automatic, but possible using alarms
Maximum operations per secondUnlimited cached reads10,000+ reads/s per bucket, 1,000+ writes/s per bucket3150 requests/second per DO3

1Free accounts are limited to 1GiB. 2A Durable Object namespace is a logical container for as many Durable Objects as you need and is backed by a class implementing the logic all those Durable Objects will share. 3Performance may depend on the specific data access patterns of your application and may be lower or higher depending on your specific application.

You can request adjustments to limits that conflict with your project goals by contacting Cloudflare. To increase a limit, complete the Limit Increase Request form.