Building D1: a Global Database
Cloudflare's Workers applications now benefit from global reach and various database options tailored to developer needs, including key-value and object storage. The company has made its relational database, D1, generally available for production workloads with the familiarity of SQL. D1 is a built-in serverless relational database that offers SQL's expressiveness and integrates with developer tooling like ORMs. It also includes a generous free tier for developers to experiment with before moving to production. D1's global read replication design aims to support data placement for globally distributed applications, using asynchronous read replication. This approach helps increase throughput by distributing load across multiple replicas and lowers query latency when the replicas are close to users making queries. D1 provides snapshot isolation consistency model, which is familiar to most developers, ensuring at most one active copy of the database. To bring read replication to D1, Cloudflare will introduce a new concept called Sessions, allowing applications to encapsulate all queries representing one logical session for their application. This feature ensures sequential consistency for all queries in the Session and is built-in, with no extra usage or storage costs. Developers can start using D1 now, and more features are expected as the company continues to address SQL database needs for developer applications.
Company
Cloudflare
Date published
April 1, 2024
Author(s)
Vy Ton, Justin Mazzola Paluska
Word count
2594
Language
English
Hacker News points
None found.