🤖 AI Hot

How Perplexity Built CobbleDB to Replace DynamoDB

A
Alex Chen

Perplexity sits on any credible list of the best AI tools 2026 has produced, and for the same reason it just made an unusual infrastructure decision: the company looked at its AWS DynamoDB bill and its read-latency curve, concluded both were wrong for its workload, and built its own database to fix them. The result is CobbleDB, a roughly 40,000-line Rust key-value store that now serves part of Perplexity’s production search traffic. Two engineers built it in about two months with help from hundreds of persistent AI coding agents, and the published numbers — median batch-read latency down from 31.4 ms to 5.60 ms, at least 20 percent lower cost — make it one of the clearest case studies yet for when it actually pays to replace a managed database with something you own.

Why Perplexity walked away from DynamoDB

DynamoDB is a reasonable default: highly available, no operations burden, usage-based pricing. Perplexity used it to hold a prepared-pages table of passages and embeddings that its search stack reads at query time. But as the corpus and query volume grew, three constraints started to bite, and Perplexity’s engineering blog is specific about each.

First, cost. DynamoDB charges per byte read and written, on top of storage. For a search engine that continuously crawls, reprocesses, and serves, those usage charges became a substantial and growing line item, and they scaled directly with index size and query volume rather than with anything Perplexity could control.

Second, a lack of performance tuning. The operation Perplexity needed was narrow — given a batch of page identifiers, return their prepared contents quickly — but the performance of that operation depended on details DynamoDB hides behind its API: which machine holds a partition, how much memory is devoted to its cache, and which replica serves a request. An uncached read, a cross-zone hop, or a slow replica could stall the entire batch, and Perplexity could not tune any of it.

Third, a coupling problem. The previous pipeline wrote each prepared page straight into the hot store, so a large reprocessing job turned into a wave of individual hot-store writes, and the pipeline had to respect the store’s throughput limits and retry behavior. Perplexity could not run a MapReduce over the whole database in a day or two to try a new chunking method, swap an embedding model, or add a field, because there was no independent stream of updates a separate service could batch and deliver at its own pace.

The architecture: three layers instead of one

The fix was not a drop-in database swap; it was a re-split of responsibilities. Perplexity separated the problem into three pieces, each with its own store and its own pace. CobbleDB is the key-value hot store that answers the query-time batch reads. Pillar holds durable document state and handles publishing. Lorry delivers batched updates asynchronously. The point of the split is that document processing no longer writes directly into the hot store, which means reprocessing runs do not hammer the serving path, and the serving path can be tuned purely for fast batched reads.

That last part is the whole ballgame. By making CobbleDB purpose-built for one workload — repeated batch reads of prepared page records, fed by an async pipeline — Perplexity could optimize exactly the things DynamoDB would not let it touch: partition placement, cache allocation, request routing, and replica selection. CobbleDB is not a general-purpose database, and Perplexity is explicit about that. It is a hot store for a specific access pattern, and the design accepts a workload-specific consistency model in exchange for control.

The numbers, with the caveat attached

The headline results are strong. Perplexity measured median batch-read latency at 5.60 ms after the migration, against 31.4 ms on DynamoDB before the cutover. The p90 fell from 56.7 ms to 9.77 ms, and the p99 from 123 ms to 24.2 ms — a roughly fivefold improvement across both typical requests and the tail, at a measurement point of about 200,000 requests per second. A later load test pushed past 500,000 requests per second before performance began to degrade. On cost, Perplexity’s internal model puts CobbleDB at least 20 percent below DynamoDB across the commitment tiers it evaluated, and it notes the real savings are likely higher because the estimate does not count backup savings from compression.

The caveat is important and Perplexity’s own reporting is careful about it: this is a before-and-after production measurement, not a controlled side-by-side benchmark. The DynamoDB numbers were recorded before the cutover and CobbleDB’s afterward, on different traffic. That does not invalidate the result, but it means the fivefold figure is “what changed in production,” not a clean A/B test of two databases under identical load. The New Stack made the same point, and it is the right way to read these numbers: directionally compelling, not laboratory-grade.

Built by two engineers and hundreds of agents

The part that makes this a story rather than just another migration is how it was built. Perplexity used two engineers and hundreds of persistent AI coding agents over roughly two months, and the division of labor is instructive. The agents carried context across sessions, wrote fixes and tests, and caught problems around restore assumptions and runtime configuration. The two humans kept control of the architecture and, critically, of the production system itself — which is why The New Stack’s headline lands the way it does: the AI agents helped build the database, and they were not allowed to run it.

That is the emerging pattern for AI-assisted infrastructure work. Perplexity joins Shopify and Ramp in the camp of companies that kept their cloud but replaced a managed service with something built to their own needs, using coding agents to make custom infrastructure affordable for a small team. The lesson is not “AI wrote a database”; it is “AI made it economical for two engineers to own a database,” which is a different and more durable claim.

What this means for an enterprise AI adoption guide

If you are putting together an enterprise AI adoption guide, CobbleDB deserves a sidebar, because it cuts against a default assumption. The reflex in most organizations is that managed services are always the right answer, and that building a database is a mistake you make once and never again. CobbleDB is a reminder that the calculus changes when your workload is narrow and your scale is high: a managed service optimizes for generality, and if your access pattern is one specific thing — batch reads of prepared records — then “general” means you are paying for flexibility you do not use and latency you cannot tune.

The transferable criteria are specific. You should only consider a move like this when your read pattern is narrow and stable, when usage-based pricing is a meaningful cost line, when tail latency directly harms the product, and when you have the team to own the operational burden that a managed service used to absorb. CobbleDB also makes the case for splitting durable state from hot serving from update delivery, because that separation is what makes each layer tunable independently — a design lesson that holds even if you never write a line of Rust. And it is a caution against treating the projected savings as the whole picture: the 20 percent figure excludes the engineers who now have to maintain the thing and respond at 2 a.m. when it breaks.

How CobbleDB compares to the big-lab approach

There is a useful contrast between what Perplexity did and what the frontier labs are doing with their own storage layers. OpenAI’s Habitat, which the company wrote about in detail this month, is a full online storage platform — a distributed service with its own API, caching, residency, and multi-tenancy, serving more than 70 million requests per second and eventually rewritten from Python to Rust. CobbleDB is the opposite philosophy at a smaller scale: a single-purpose hot store, deliberately not a platform, built to do one access pattern extremely well and leave the rest to other services.

The two approaches teach the same underlying lesson in different registers. Both teams concluded that a general-purpose storage layer eventually becomes the bottleneck when your workload is specific and your scale is high, and both solved it by taking control of the thing that was hurting — OpenAI by building a platform, Perplexity by building a narrow store. The difference is a matter of what you can afford to own. OpenAI can maintain a platform team; Perplexity used two engineers and coding agents to make a smaller, sharper tool economical. For most teams reading this, the CobbleDB end of the spectrum is the relevant one: you probably do not need a Habitat, but you might be surprised how far a purpose-built store with a clean separation of responsibilities gets you.

Who should pay attention, and who should not

This is worth reading closely if you run a read-heavy, latency-sensitive serving layer, if you are wrestling with DynamoDB read pricing at scale, or if you are interested in how AI coding agents change the economics of custom infrastructure. The architecture split — hot store, durable state, async update delivery — is genuinely reusable even for teams that stay on managed services.

You can skip the deep details if you are not in the infrastructure weeds. This is not a model release or a benchmark story; there are no token counts or leaderboard scores. And if your instinct is “never build your own database,” that instinct is usually right — CobbleDB is an exception that proves the rule, not an argument that every team should roll their own store.

Limitations and caveats

The honest caveats keep this grounded. First, the latency numbers are before-and-after production measurements, not a controlled benchmark, so the fivefold figure is what changed on Perplexity’s specific traffic, not a general property of CobbleDB versus DynamoDB. Second, the cost estimate is an internal model that covers storage and read/write capacity but explicitly excludes the engineering and maintenance cost of operating custom infrastructure, which is where the real expense of owning a database lives. Third, CobbleDB is purpose-built for one workload and is not a general-purpose database, so none of this generalizes to a team with a broader access pattern. Fourth, the plan to open-source is stated as an intention, not a shipped artifact — as of this writing the code is not public, so independent evaluation is not possible. Finally, this is a young system; the harder test is how it behaves under incident conditions and schema changes over the next year, not how it performed in its first cutover.

Sources

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen