Perplexity slashed its median batch-read latency from 31.4 milliseconds to 5.6 ms after building a custom database to replace Amazon's DynamoDB, according to a detailed technical writeup published by The New Stack. The AI search company developed CobbleDB, a roughly 40,000-line Rust key-value store, in just eight weeks with two engineers and hundreds of AI coding agents. The switch is expected to reduce costs by at least 20% while giving the company direct control over read performance for production search traffic.

The performance gains extended beyond median latency. The 99th percentile latency dropped from 123 ms on DynamoDB to 24.2 ms on CobbleDB, an 80% improvement at the high end. Perplexity was processing around 200,000 requests per second when it recorded these figures, and subsequent load testing showed CobbleDB maintained performance up to 500,000 requests per second before degradation began. Each search API call retrieves 100 to 120 page keys in batches of 10 to 20, with each item averaging roughly 50 KB. The cost projections put CobbleDB at least 20% below DynamoDB across evaluated commitment options, though that estimate excludes the engineering expense of maintaining the database long-term.

The report notes that the latency comparison comes with a significant caveat: DynamoDB and CobbleDB weren't measured side by side under identical conditions. The DynamoDB numbers were captured before the migration, while CobbleDB's metrics came afterward. According to the writeup, DynamoDB gave Perplexity minimal control over how it managed reads, meaning a sluggish replica could stall an entire batch. CMU professor Andy Pavlo, cited in the report, argued at Percona Live earlier this year that databases represent the toughest and most critical challenge for AI agents, partly because errors involving production data can be hard or impossible to undo.

DynamoDB's limitations became unsustainable as Perplexity's traffic and document corpus expanded. The managed service charged for the continuous stream of large reads and writes produced by search, crawling, and reprocessing, making cloud costs difficult to justify at scale. That pressure drove the company to separate long-term document storage from the database serving live queries. The new architecture splits storage into three tiers: Pillar maintains durable document state in YTsaurus on hard drives, Lorry packages updates into partition-specific batches and shuttles them through S3, and CobbleDB distributes processed page data across three replicas per partition with hashed URLs as keys. RocksDB keeps frequently accessed data in memory while the remainder sits on local NVMe drives, and the router can query another replica if one lags instead of waiting on the slow one.

The AI agents carried context between sessions, identifying issues with restore assumptions and runtime configuration while working on fixes and tests, but they didn't operate the database itself. The two engineers retained authority over architecture decisions and the production system, which the report emphasizes was especially important given Pavlo's caution about positioning agents near critical production data. Perplexity kept its cloud infrastructure but swapped a managed service for something tailored to its specific requirements, similar to moves by Shopify and Ramp when they built custom coding agents around third-party models. The report concludes that CobbleDB demonstrates how AI-assisted development is shifting the calculus for engineering teams, making custom infrastructure feasible for smaller groups. Perplexity plans to open-source the database at some point, though delivering CobbleDB in two months addressed an immediate bottleneck while creating a maintenance burden that could prove far more challenging over time. Companies evaluating build-versus-buy decisions now face a different set of constraints when agent-assisted tooling can compress timelines this dramatically. The hidden question is whether velocity at the start trades predictability for operational fragility later, a calculation that won't resolve until production systems age under real load.