SurrealDB Earth: the serverless database on Cloudflare

SurrealDB

5 min read Original article ↗

10+ billion Peak rows per second. Fully transactional.

  • Elastic. Dynamic. Serverless.
  • As many agents and users as you need.
  • Scales to zero instantly.
  • Instance creation time ~500ms.
  • Cold start time ~300ms.
  • Single-tenant deployments.
  • Highly available. Fully transactional.
  • 1+ billion rows scanned per second.
  • Regional storage. Multi-region queries.
  • Web-native. HTTP + WebSocket.
  • Built on Cloudflare.

One query. Thousands of compute units. One answer.

A client sends a query to a coordinator, which splits it across SurrealDB Earth cells on Cloudflare. Each cell reads its share of the data from object storage, every leg reading the same point in time, and the results are merged into one answer, transactional throughout. At peak, that is 10+ billion rows per second.

A query fanning out from a coordinator across SurrealDB Earth cells to object storage

Load rises. Earth scales up with it.

Load falls, and Earth scales back down, to zero. Earth starts with one client, and as more arrive it adds database cells to serve them, each handling its share of the transactions against object storage. As the load falls, the cells are removed until nothing is left running, with no idle server costs.

Database cells added as transactions climb and removed as they fade

THE IDEA

One database per agent, user or customer.

A database for every agent.Each one its own instance.

Every Earth database is its own isolated instance, with dedicated storage and commit log, so one customer's data stays apart from another's and a database can be deleted on its own.

Starts on its first query.Scales to zero when idle.

A database cold starts in ~300ms and scales to zero instantly when idle, while its data stays durable in Cloudflare's storage. A quiet database uses no active hours.

The SurrealDB engine.Serverless on Cloudflare.

Earth runs the same engine as every SurrealDB deployment: SurrealQL, with graph, documents, vectors and full-text search in one transaction.

HOW IT WORKS

From the first query to zero. SurrealDB, built on Cloudflare.

Create

A new database is its own instance, with dedicated storage and commit log, created in about 500ms from Studio, the CLI or an agent over MCP.

Wake

The first query starts it, in about 300ms from cold. Earth is web-native, so clients connect over HTTP and WebSocket.

Commit

Each database has one strict commit order. Commits are batched and sequenced, and small commits are staged in Cloudflare's Durable Object storage, so every write is transactional.

Store

Data that has been rolled, merged and folded lives in R2, so a database's storage follows it and stays durable while it is idle.

Scale out

One query splits across Workers and merges its answer, with every leg reading the same point in time.

Rest

When the last request ends, the database scales to zero instantly. A quiet database uses no active hours, and its data stays where it is.

A rebuilt query core.Compiled to bytecode.

SurrealQL compiles to a bytecode VM and runs through a parallel query execution engine. While the core was rebuilt, every query test ran on the old engine and the new one, to confirm they gave the same answers.

Every data model.In one transaction.

Graph, documents, vectors and full-text search come back together in one query and commit in one ACID transaction. In the latest release, a 1% filtered vector search went from 27 ms to 1.1 ms.

One engine everywhere.Write the query once.

Earth runs the same engine as SurrealDB embedded, in the browser, on your own servers and in SurrealDB Cloud, so a query written for one runs unchanged on the others.

SurrealDB Earth's launch film: the globe of Cloudflare's network

ONE ENGINE

Earth is one way to run it. The same SurrealDB engine, wherever it runs.

SurrealDB on Cloudflare

One isolated database per agent, user or customer, starting on its first query and scaling to zero when idle, billed by requests, storage and active hours.

SurrealDB on AWS Azure

Always-on nodes, single-node or clustered, billed by the node hour. Multi-node clusters run on SurrealDS, which stores each write on disks in two zones before confirming it.

Self-hosted

SurrealDB runs embedded in an application, in the browser, as a server on your own machines, or as Enterprise Edition with SurrealDS.

Agent Memory

Memory for agents as a managed service on the same engine: typed facts, a knowledge graph and recall, with every fact keeping its source.

QUICKSTART

From sign-up to a first query. Start free now: 3M requests, 10 GB and 100 database hours a month, with no card needed. Or create a database from the CLI or an agent.

Start free

CLI

Create a database

With the SurrealDB CLI signed in to Cloud, one command creates an Earth database.

surreal cloud instance create my-agent --region earth

MCP

Ask an agent

An agent connected to the SurrealDB MCP server can create the database itself.

Using the SurrealDB MCP, create a SurrealDB Earth database called "my-agent".

SurrealQL

Run a first query

Records and a graph edge are written in one transaction, then read back across the edge.

BEGIN TRANSACTION;
CREATE agent:scout SET name = "Scout";
CREATE task:launch SET title = "Launch on Earth";
RELATE agent:scout->works_on->task:launch SET since = time::now();
COMMIT TRANSACTION;

SELECT name, ->works_on->task.title AS tasks FROM agent:scout;

Your questions,answered

SurrealDB Earth is serverless SurrealDB, built on Cloudflare. Every Earth database is its own isolated instance, with dedicated storage and commit log. It starts with the first query, cold starts in ~300ms and scales to zero instantly when idle, so there are no idle server costs.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.

Justin Foley

VP of Engineering, Later

GET STARTED

Give every agent a database of its own. Serverless SurrealDB, built on Cloudflare. Free to start, with no card needed.