Choose a data or storage product (3)
Last updated Oct 21, 2026 This guide describes the storage & database products available as part of Cloudflare Workers, including recommended use-cases and best practices.
Choose a storage product
The following table maps our storage & database products to common industry terms as well as recommended use-cases:
| Use-case | Product | Ideal for |
|---|---|---|
| Key-value storage | Workers KV | Configuration data, service routing metadata, personalization (A/B testing) |
| Object storage / blob storage | R2 | User-facing web assets, images, machine learning and training datasets, analytics datasets, log and event data. |
| Accelerate a Postgres or MySQL database | Hyperdrive | Connecting to an existing database in a cloud or on-premises using your existing database drivers & ORMs. |
| Global coordination & stateful serverless | Durable Objects | Building collaborative applications; global coordination across clients; real-time WebSocket applications; strongly consistent, transactional storage. |
| Lightweight SQL database | D1 | Relational data, including user profiles, product listings and orders, and/or customer data. |
| Task processing, batching and messaging | Queues | Background job processing (emails, notifications, APIs), message queuing, and deferred tasks. |
| Event streaming | K2 | High-volume event data read by multiple independent consumers, such as alerting, archiving, and building machine learning features; replaying retained events. |
| Vector search & embeddings queries | Vectorize | Storing embeddings from AI models for semantic search and classification tasks. |
| Streaming ingestion | Basin Pipelines | Streaming data ingestion and processing, including clickstream analytics, telemetry/log data, and structured data for querying |
| Time-series metrics | Analytics Engine | Write and query high-cardinality time-series data, usage metrics, and service-level telemetry using Workers and/or SQL. |
Applications can build on multiple storage & database products: for example, using Workers KV for session data; R2 for large file storage, media assets and user-uploaded files; and Hyperdrive to connect to a hosted Postgres or MySQL database.
Pages Functions
Storage options can also be used by your front-end application built with Cloudflare Pages. For more information on available storage options for Pages applications, refer to the Pages Functions bindings documentation.
SQL database options
There are three options for SQL-based databases available when building applications with Workers.
- Hyperdrive if you have an existing Postgres or MySQL database, require large (1TB, 100TB or more) single databases, and/or want to use your existing database tools. You can also connect Hyperdrive to database platforms like PlanetScale ↗︎, Neon ↗︎, or Supabase ↗︎.
- D1 for lightweight, serverless applications that are read-heavy, have global users that benefit from D1's read replication, and do not require you to manage and maintain a traditional RDBMS.
- Durable Objects for stateful serverless workloads, per-user or per-customer SQL state, and building distributed systems (D1 and Queues are built on Durable Objects) where Durable Object's strict serializability ↗︎ enables global ordering of requests and storage operations.
Session storage
We recommend using Workers KV for storing session data, credentials (API keys), and/or configuration data. These are typically read at high rates (thousands of RPS or more), are not typically modified (within KV's 1 write RPS per unique key limit), and do not need to be immediately consistent.
Frequently read keys benefit from KV's internal cache, and repeated reads to these "hot" keys will typically see latencies in the 500µs to 10ms range.
Authentication frameworks like OpenAuth ↗︎ use Workers KV as session storage when deployed to Cloudflare, and Cloudflare Access uses KV to securely store and distribute user credentials so that they can be validated as close to the user as possible and reduce overall latency.
Product overviews
Workers KV
Workers KV is an eventually consistent key-value data store that caches on the Cloudflare global network.
It is ideal for projects that require:
- High volumes of reads and/or repeated reads to the same keys.
- Low-latency global reads (typically within 10ms for hot keys)
- Per-object time-to-live (TTL).
- Distributed configuration and/or session storage.
To get started with KV:
- Read how KV works.
- Create a KV namespace.
- Review the KV Runtime API.
- Learn about KV Limits.
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 (for example, gigabytes or more per object).
- Strong consistency per object.
- Asset storage for websites (refer to caching guide)
To get started with R2:
- Read the Get started guide.
- Learn about R2 Limits.
- Review the R2 Workers API.
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:
- Read the introductory blog post ↗︎.
- Review the Durable Objects documentation.
- Get started with Durable Objects.
- Learn about Durable Objects Limits.
D1
D1 is Cloudflare’s native serverless database. With D1, you can create a database by importing data or defining your tables and writing your queries within a Worker or through the API.
D1 is ideal for:
- Persistent, relational storage for user data, account data, and other structured datasets.
- Use-cases that require querying across your data ad-hoc (using SQL).
- Workloads with a high ratio of reads to writes (most web applications).
To get started with D1:
- Read the documentation
- Follow the Get started guide to provision your first D1 database.
- Review the D1 Workers Binding API.
Note
If your working data size exceeds 10 GB (the maximum size for a D1 database), consider splitting the database into multiple, smaller D1 databases.
Queues
Cloudflare Queues allows developers to send and receive messages with guaranteed delivery. It integrates with Cloudflare Workers and offers at-least once delivery, message batching, and does not charge for egress bandwidth.
Queues is ideal for:
- Offloading work from a request to schedule later.
- Send data from Worker to Worker (inter-Service communication).
- Buffering or batching data before writing to upstream systems, including third-party APIs or Cloudflare R2.
To get started with Queues:
- Set up your first queue.
- Learn more about how Queues works.
K2
K2 is a durable event log. Producers write records to a stream, and K2 stores them for a configurable retention period. Consumers read records in batches through subscriptions, and each subscription reads every record independently.
