2026-02-26
The database marketplace is harsh, peculiarly for newcomers. It’s very difficult to motorboat a caller merchandise and differentiate yourself from the incumbents. Even harder to summation immoderate agelong word traction. Earlier this week, SpacetimeDB launched type 2.0 of their database pinch a peculiar attack that —as acold arsenic I tin tell— hasn’t been done before: a somewhat surreal (meme-y) video wherever they mock their competitors (drinking “competitor’s tears”) and a group of benchmarks that look excessively bully to beryllium existent (they are, indeed, not true), and that besides mock different databases. Look astatine the tiny magnifying solid adjacent to the big losers of that benchmark. You gotta zoom in to spot really overmuch they suck! Good stuff.

I’ll beryllium upfront and admit that I find this distasteful. But nonetheless, I deliberation location are absorbing ideas successful this product, and I’d for illustration to do a short method reappraisal whilst being arsenic adjacent arsenic possible.
Benchmarks #
One communal correction newcomers to the database abstraction make is believing that you tin triumph by having “the champion performance”. I’ve ne'er seen this successful practice. The (very few) companies that person built a sustainable database offering are winning by providing good, honorable method activity that stands connected its own. Of course, having benchmarks definitely helps pinch that. But past the benchmarks have to beryllium good, honorable method work.
The ones that SpacetimeDB provided are nary of those things. They person rather a fewer method flaws successful what they measure. You tin spot an alternate group of benchmarks here wherever SpacetimeDB stacks up very poorly against the competition.
Nonetheless, the large basal flaw successful those benchmarks is that they’re not honest. And I get wherever they’re coming from, I do: they’re not honorable because their database offering is thing very different to the competition, and that makes it very enticing to constitute benchmarks for illustration that. Their merchandise is successful a different conception of the database space, and they’re choosing to comparison their merchandise against databases that make different tradeoffs. It’s an appealing comparison, but it’s not a adjacent one.
I’ll springiness you an illustration of what this looks like, which I went done myself: a mates years agone I was moving astatine PlanetScale and we shipped a MySQL hold for vector similarity search. We had immoderate very circumstantial goals for the implementation; it was very different from everything other retired location because it was afloat transactional, and the vector information was stored connected disk, managed by MySQL’s buffer pools. This is successful opposition to simpler approaches specified arsenic pgvector, that usage HNSW and require the similarity chart to fresh successful memory. It was a very different product, pinch very different trade-offs. And it was immensely alluring to return an EC2 lawsuit pinch 32GB of RAM and propulsion successful 64GB of vector information into our database. Then do the aforesaid pinch a Postgres lawsuit and pgvector. It’s the nonstop aforesaid machine, nonstop aforesaid dataset! It’s doing the aforesaid queries! But PlanetScale is doing tens of thousands per 2nd and pgvector takes much than 3 seconds to decorativeness a azygous query because the HNSW chart keeps being paged backmost and distant from disk.
It was so very alluring to show that successful a benchmark. “We’re 10000 times faster than pgvector!”. But travel connected now. That’s not honest. Yes, it’s the aforesaid machine, the aforesaid dataset, and the aforesaid queries, but it’s not the aforesaid thing. We did not people those benchmarks; alternatively we published a method breakdown of the implementation, without unfair comparisons, which was very good received.
You don’t request “INSANE BENCHMARKS” to triumph astatine this. You conscionable request coagulated method activity and coagulated method penning explaining the trade-offs and limitations of your offering. You tin spot different illustration pinch Turbopuffer. Their benchmarks are not impressive, peculiarly erstwhile compared to their competitors. Their archiving has much lines discussing the things the database cannot do than the things it can do. But everyone knows that if your usage lawsuit fits their offering, they person the champion merchandise for hunt successful the market. Miles up of the competition. They don’t portion their competitors’ tears, they conscionable softly return their customers.
Anyway: backmost to SpacetimeDB and their benchmarks. They person a very different offering than their competitors! It’s an all-in-one database + exertion server, wherever you deploy a database lawsuit and your application’s codification runs wrong the database itself. That’s a very absorbing idea, I think. You could opportunity it’s conscionable for illustration stored procedures successful a relational database, but pinch amended developer experience. Fair. But you tin wholly build a viable merchandise retired of that, though!
You gotta admit, however, that it has very small to do pinch the multi-region, highly disposable distributed databases against which it’s benchmarking itself. If your exertion codification is moving inside the database and your competitors person a abstracted exertion that must execute individual web requests for each query, past yes, you should beryllium up successful benchmarks that measurement QPS. But are those honorable benchmarks? Is that comparison what you want to show to imaginable customers evaluating your method offering?
I’d opportunity it’s not a very bully point to highlight. Accessing information in-memory is faster than accessing information complete a network, and you’ve built a benchmark harness to beryllium that. As a imaginable user, I americium not very impressed. I deliberation from a trading constituent of view, it would beryllium overmuch much absorbing to show really accelerated you tin entree information in-memory, and past explain the trade-offs you’ve taken to get astatine those speeds.
From what I gather, there’s nary clear method breakdown connected their website that explains this. So let’s springiness it a spell here.
Storage #
There are respective reasons why SpacetimeDB shows specified bully constitute capacity successful the synthetic benchmarks they’ve published. Obviously, the elephant successful the room is that exertion logic runs locally adjacent to the database and it tin beryllium exceedingly businesslike erstwhile penning to the information shop that way. They boost this ratio moreover further pinch different tricks (such arsenic batching writes), but to get to the capacity numbers they’re showing, you request to trim corners somewhere: the information shop is in-memory, which is very overmuch dissimilar a accepted RDBMs.
Now: The bully news is that writes to the in-memory shop are linearizable. There’s immoderate bad news, however. Proving linearizability of a strategy is usually an arduous task; I did not request to whip retired TLA+ to do it here. Here it is trivially provable. Because the strategy is, well, a hash array pinch a fastener successful beforehand of it.
This whitethorn look exaggerated but spot me, it really a rather meticulous explanation of really the retention motor is designed. The committed authorities for the full database successful a SpacetimeDB lawsuit is wrapped successful a azygous Read-Write Mutex. All constitute operations hap sequentially, which is so trivial impervious of linearizability. Two writes cannot hap astatine the aforesaid time, truthful they cannot conflict aliases race. But a read and a write cannot hap astatine the aforesaid clip either!
What happens if location are excessively galore writes? Do the readers starve? Building a information shop connected apical of a azygous world fastener pinch read/write semantics is simply a valid method choice. Perhaps it is simply a spot questionable to marketplace that arsenic “a database”. But it seems to maine that if you’re going each successful pinch that approach, if that fastener will supply the concurrency power for your full database, you request to person very explicit, customizable semantics for prioritizing readers and writers, to guarantee the server remains responsive sloppy of the workload.
In this case, the behaviour is an implementation detail, not peculiarly defined nor explained anywhere. The mutex is an off-the-shelf parking_lot::RWMutex, from the parking_lot crate. It has eventual fairness, which intends that readers will eventually get the lock, moreover during precocious write-throughput scenarios. They will beryllium randomly delayed, though, up to 0.5ms. The parking_lot crate is simply a Rust larboard of WebKit’s original WTF::Lock — this 2024 changeset shows really eventual fairness was implemented there. You should publication it, it has very bully capacity insights connected mutex contention. Think of it arsenic a palate cleanser from this blog post. Now backmost to the hash array & the lock.
So what happens successful this strategy during a write? Well, anything happens. It really is rather magical. While the world fastener is held, a Wasmtime runtime is utilized to execute “reducers” (arbitrary personification code, compiled to WebAssembly). While the reducer is executing, nary different reducers tin execute and constitute to the database. No different codification tin read from the database either. From their charismatic documentation, reducers “cannot execute HTTP requests”. Yeah. No shit. The captious conception for each writes to this database is exclusive and serialized, and it executes arbitrary personification code. You’d amended not beryllium doing HTTP requests successful the mediate of it.
There’s a spot of an flight hatch here: you tin usage “Procedures” successful the server. As of this week’s merchandise they are still successful Beta (the archiving warns that the API whitethorn alteration successful the future). They do let you tally costly code, including HTTP requests, truthful that’s a bully thing. From wrong a procedure, you tin unfastened a transaction, which again acquires the world mutex and doesn’t let immoderate different concurrent writes nor sounds to the database, truthful make judge you perpetrate it very very quickly aliases the full strategy will stall.
For reads, the communicative is very similar. They’re expected to hap done “Views”, which are the read-only balanced to reducers. Since they get a scholar fastener connected the world mutex, respective views tin tally concurrently, but the database cannot beryllium written to while views are executing. Just for illustration reducers, views are arbitrary personification codification compiled to WebAssembly.
Durability #
One evident consequence of this single-mutex creation for a database is that you request to beryllium doing the slightest magnitude of activity imaginable successful the captious way for the transaction. HTTP requests are decidedly retired of the question. But you cannot do different “expensive” worldly for illustration immoderate different RDBMs often do, specified as, you know, persisting the transaction to disk (teehee).
This afloat in-memory database is backed by a Write Ahead Log, but the WAL is not committed to disk arsenic portion of the constitute transaction. The WAL is asynchronous, and is flushed periodically to disk on the background (by default, each 50ms).
Can you really make this afloat consistent? The limitations of the “single mutex design” make this complicated, arsenic the WAL tin ne'er beryllium written synchronously (it would wholly stall each different writes and sounds successful the application). The strategy does supply an action when reading, pinch peculiar semantics. The withConfirmedReads emblem allows sounds to only return information that has been synced to disk, by sleeping connected the server until it yet sees the WAL entries for the consequence of the query flushed to disk. This tin beryllium a slumber of up to 50ms, which is simply a agelong clip for a request. It’s not a very ergonomic behavior, but the presumption present is that this is simply a database for “mostly ephemeral” information and your mean query doesn’t request this benignant of highly accordant guarantee.
This full point is giving large MongoDB-2011 vibes. In galore ways, really. The guys astatine Mongo launched a beautiful shitty database pinch very awesome benchmarks, and yet sewage builled by the net (see: MongoDb is Web Scale) into implementing a due retention engine. They acquired WiredTiger, which really is a due retention engine. Fifteen years later, they are a superior and viable database company. And yet there’s still a batch of method group who retrieve the early days of Mongo and garbage to usage it successful accumulation aliases urge it. Their accusation is outdated. Modern Mongo is simply a superior database that works. But the bad method estimation lingers, and will linger forever.
I deliberation there’s a large instruction to beryllium learned here: successful 2026, if I were to motorboat a database merchandise that is simply a hash array pinch a azygous fastener successful beforehand of it, I’d do it quietly. Because cutting corners erstwhile launching a database merchandise has been proved to beryllium a viable attack (I wouldn’t do it myself, but MongoDB did it pinch awesome success). But arsenic soon arsenic the merchandise catches on, if it does, you request to unreserved to salary backmost the method indebtedness and the reputational debt. A trading video pinch laser beams and a “bottle of tears” makes this overmuch much complicated.
Tradeoffs #
We’ve seen the method choices that let SpacetimeDB to execute truthful good successful circumstantial benchmarks (i.e. benchmarks wherever they measurement really accelerated our exertion tin constitute to the database; fixed that our exertion is the database). These choices are not explained upfront successful the documentation, and sadly the trade-offs that these choices connote are also not explicitly listed.
Going done them briefly: this is not a distributed strategy and it has a very difficult limit connected scalability aliases availability. You tin deploy a “SpacetimeDB cluster”, meaning a superior lawsuit and respective followers pinch yet accordant replication (emphasis connected yet consistent; the WAL is yet consistent, the replication is too, there’s a batch of separator for things to spell incorrect here), but your full strategy is bottlenecked by the CPU and RAM capacity of the instrumentality wherever your main SpacetimeDB lawsuit is deployed. You request capable CPU for your database to execute each the queries, but also for your full exertion to execute each its exertion logic, arsenic again the exertion lives wrong the database. You request capable RAM to fresh each your database’s information in-memory. SpacetimeDB is not disk-backed astatine all; it conscionable flushes a WAL to disk (and periodically, snapshots that make recovering from the WAL quicker connected restarts). If your dataset grows larger than RAM, your database (and your application, which are the aforesaid thing) will neglect over. The only action for scalability present is vertical: buying a bigger instrumentality to tally your database.
These tradeoffs are, again, perfectly valid. But they intelligibly position SpacetimeDB arsenic “a much powerful Redis”, not “a much performant relational database”. It’s very puzzling why the authors chose to benchmark arsenic the later.
Use Cases #
The original type of SpacetimeDB was developed arsenic the backend of an MMORPG (a existent crippled that you tin play successful Steam correct now). That seems adjacent to me. I deliberation each the method choices successful the database fresh this usage case. You tin asynchronously flush to disk a WAL introduction that says that xXxPussyHunter420xXx has looted [Thunderfury, Blessed Blade of the Windseeker]. 50ms of hold is OK here. He’ll get upset if the lawsuit crashes conscionable correct then, but he’ll get complete it.
Of course, there’s not a batch of studios building MMORPGs correct now, and the ones that are building immoderate benignant of multiplayer games really thin to for illustration their ain in-house backends. They’re ample studios aft all, they’ve done this before. So I wholly get why they’re pivoting SpacetimeDB v2 into thing pinch broader appeal.
Their trading page now says that “LLMs spell overmuch further pinch SpacetimeDB because it handles each the persistence, logic, deployment, and real-time sync successful a azygous cohesive backend.” That’s besides a adjacent choice. Agentic coding is the point happening correct now. Building a database that targets LLMs seems for illustration a bully idea. But I’ll beryllium honorable here: they virtually made the worst imaginable method choices for this usage case.
The full shtick of SpacetimeDB is that the capacity and readiness of some your exertion and your database is 100% dominated by short segments of personification codification which cannot execute immoderate operations pinch broadside effects aliases stalls, because they’re compiled to WebAssembly and executed by a virtual instrumentality wrong a captious conception that serializes each writes and sounds to the retention backend of your application. The absence of broadside effects aliases stalls cannot beryllium enforced by the type system, and is limited connected the peculiar WASM bytecode that is generated by a JIT compiler astatine runtime. Any correction wrong these captious sections, immoderate cognition that could origin them to stall nether load, is astir apt only going to beryllium seen successful production, and is going to degrade the capacity of your full exertion — astir apt to the constituent of causing an readiness issue.
This is not the perfect situation for a LLM to programme in. lol
Having said that: I deliberation there’s a merchandise here, and immoderate lessons to learn. Perhaps the authors yet use them to SpacetimeDB v3 and motorboat a much resilient and LLM-friendly database, wherever exertion codification is isolated and tin tally for arsenic agelong arsenic it needs, without perchance affecting different exertion codification moving locally, moreover erstwhile faced pinch superior implementation bugs; wherever transactions tin tally for arsenic agelong arsenic they request without affecting the capacity of different transactions; wherever they’re implicitly throttled if they’re taking excessively long, if the LLM did not supply an optimal query plan. Perhaps we’ll spot a strategy that is overmuch much resilient to failure, but pinch overmuch little “impressive performance”; possibly the strategy will beryllium trivially distributed truthful that the AI supplier doesn’t person to scheme a distributed strategy itself; possibly it will motorboat pinch less silly benchmarks and pinch much method details.
Now that’d beryllium a merchandise to support an oculus retired for.
English (US) ·
Indonesian (ID) ·