Why you shouldn't do application-level sharding
Application-level sharding of an OLTP database looks simple on day one (a `shard_for(user_id % N)` function) but accumulates serious engineering burdens as a system grows.
Application-level sharding of an OLTP database looks simple on day one (a `shard_for(user_id % N)` function) but accumulates serious engineering burdens as a system grows.
Before launching Claude Docs, a two-week "chaos loop" had Claude Code drive a production-mirroring staging cluster at over a million synthetic docs a day, inject failures (mass reconnects, killed servers, stalled databases, hot docs), read Datadog telemetry, and ship fixes, with a human approving only hard-to-undo changes like schema or storage layout.
Datadog's metrics aggregation service, which merges DDSketch distributions to reduce tag dimensions, went through three generations as volume grew roughly 10× each time.
GitHub's new Git storage architecture, Rubicon, rests on one observation: only reference updates need ordering.
Pando is OpenAI's new Git backend for its monorepo, built to handle the concurrent pushes and fetches generated by Codex-driven parallel development while staying fully compatible with the Git protocol and client.
Cloudflare's DNS Zone Builder now uses a targeted build planner that picks the smallest provably safe build (resources only, resources plus metadata, apex plus metadata, purge, or full zone) and a unified per-zone scheduler that merges queued work.
DBOS Transact adds workflow rewind to any step, which discards checkpoints from that step onward and re-executes while preserving the workflow ID.
Sharding Postgres with PgDog let DBOS durable workflow throughput scale linearly from 20K workflows/sec on one db.m7i.4xlarge RDS instance to 1M workflows/sec across 50 shards.
OpenAI's Habitat storage platform went from one shared Azure Cosmos DB container, to per-use-case dedicated containers, and back to a shared multi-tenant container.
OpenReplay, a self-hosted session replay and product analytics platform, moved behavioral event storage from Postgres to ClickHouse.
GitHub has moved nearly all Git repositories to replicas split between its own data centers and Azure.
The 2026 World Cup set Meta platform records, including WhatsApp peaking above 30 million messages per second during the final, with traffic surges driven by match breaks and whistles rather than live gameplay.
Managed ClickStack adds z-score anomaly detection to query-builder charts, computing the expected value from a 7-bucket one-minute moving average and the standard deviation over a longer baseline (two hours by default).
Ridgeline, an all-in-one investment management platform, moved performance analytics off a shared Postgres cluster onto ClickHouse Cloud.
Meta's 2026 GEM replaces per-surface ads ranking models with a single central recommendation foundation model trained across Facebook, Instagram, Reels and deep-funnel conversion objectives, reporting 18.9% conversion and 12% CTR gains.
Anthropic replaced git with Scion, an in-house centralized version control system, after its monorepo grew past what git mirrors could serve.
GitHub is rebuilding its Git storage layer because agent-driven workloads are colliding with the design of Spokes.
Using a SAVEPOINT per tick in a Postgres-backed job queue made every locked row carry a MultiXact ID in xmax.
LinkedIn's observability team consolidated a legacy metric metadata system (a custom in-memory search index, a custom KV store and Elasticsearch behind one gateway) onto a single-shard ClickHouse index.
Docker containers on Railway can be deployed either by having Railway build from a Dockerfile (via BuildKit with cache mounts, configurable with RAILWAY_DOCKERFILE_PATH) or by pulling a pre-built image from a registry such as Docker Hub, GHCR or ECR Public.
When a shard key like tenant_id stops matching reality because a few whale tenants dominate load or cross-tenant queries appear, Neki (PlanetScale's sharded Postgres from the Vitess maintainers) offers three escalating fixes: vertically scale the hot shard with its own configuration profile, isolate the whale by narrowing hashed key ranges in the declarative data topology, or reshard specific tables by a better key.
Habitat, OpenAI's online storage platform, grew from a client-side Python library over Azure Cosmos DB into a centralized Python service handling 70M+ requests per second and 500+ PB across about 40 regions.
ClickHouse Cloud On-Demand Compute, now in private preview, lets a query run on a shared pool of ClickHouse workers outside the service's own cluster by setting make_distributed_plan and distributed_plan_workers_num.
ZGateway is a stateless regional proxy tier in front of ZippyDB, Meta's most widely used key-value store.
Shopify consolidated metrics, logs, traces, exceptions and profiles from multiple vendors onto Observe, an internal observability platform built on self-hosted ClickHouse, and saw a 16x query improvement out of the box (over 30x at peak) along with predictable costs.
Datadog replaced CI fetches from a replicated Gitaly/Praefect cluster with gitretriever, a fleet of independent Git mirrors that poll GitHub per changed ref and fan packfiles out to autoscaled relays over a gRPC signaling stream plus HTTP.
PgDog avoids RDS Proxy's connection pinning, which silently disables transaction pooling when apps use SET, temporary tables, advisory locks, or queries over 16 KB, and can exhaust Postgres connections.
Meta scales sequence learning for ads ranking by splitting it into two stages: an offline transformer user model processes thousands of user events asynchronously and caches user-level embeddings, and a lightweight online ranking model combines those embeddings with fresh signals and ad candidates under strict latency budgets.
Mercado Libre moved the storage layer of its OpenTelemetry-based tracing platform, O11y events, to ClickHouse Cloud.
Canva moved its gateway session-revocation cache from per-pod MySQL loads to sorted binary chunks in S3, eliminating the database stampede when hundreds of gateway pods started during deploys.
incident.io moved nearly all Postgres read traffic to a read replica and had to preserve read-after-write consistency without hand-routing each query.
Riviera, Dropbox's content processing platform, grew from an internal file-preview service into shared infrastructure behind Search, Replay, Sign and Dash.
Modal rebuilt its sandbox control plane to run 1 million concurrent sandboxes, creating all of them in under a minute, by removing central coordination and durable stores from the creation path.
Because PgBouncer is single-threaded, ClickHouse Managed Postgres runs a fleet of PgBouncer processes sized to the core count, all binding one port via so_reuseport so the kernel load-balances connections behind a single endpoint.
LogHouse, ClickHouse Cloud's internal logging platform, has grown to 431 PiB uncompressed (27 PiB on disk) and 1.59 quadrillion rows across 36 cells in 33 geoshards on three clouds, ingesting up to 80 GiB/s and 190M rows/s.
Zalando moved the high fan-out internal traffic of its Product Read API (over a million requests per second at peak) off the shared Skipper ingress and onto an in-process client-side load balancer.
The D. E. Shaw group moved per-task resource metrics from its HPC grid, millions of high-cardinality time series keyed by unique task IDs, from an InfluxDB-protocol time-series platform to ClickHouse.
Railway replaced its docker-buildx-on-GCP-VMs build system with Builder v3: 256-vCPU bare-metal hosts split into eight 32-vCPU microVM build cells running buildkitd, scheduled with a 1-of-3 ring to keep BuildKit caches warm, now peaking at 66,000 builds per hour.
Shopify moved checkout inventory reservations from Redis to MySQL by modeling one row per sellable unit and using SELECT ...
Kubernetes v1.36 adds alpha server-side sharded list and watch (KEP-5866), letting the API server filter list responses and watch events so each horizontally scaled controller replica receives only its slice of a resource collection instead of deserializing and discarding the full stream.
Figma replaced PgBouncer with PGKeeper, a Go service built on PGX that sits between its DBProxy router and each Postgres instance.
FigCache is a stateless Go proxy that speaks the Redis RESP wire protocol.
Scale in OLTP is framed as survivability: a system cannot grow beyond the size it can recover, and when rebuild time (MTTR) exceeds time between failures it enters a death spiral.
Replo's in-product analytics for Shopify merchants ingests 3,000-5,000 events per second into ClickHouse and analyzes 100+ billion events, but reaching that point took several data-model resets.
Langfuse moved its LLM tracing data from a single-node Postgres instance to ClickHouse after ingestion growth caused timeouts, high IOPS costs and slow SDK ingestion.
OpenAI serves millions of queries per second for ChatGPT and its API from a single unsharded Azure PostgreSQL primary plus nearly 50 geo-distributed read replicas, despite load growing more than 10x in a year.
Polymarket moved analytical workloads off its production PostgreSQL cluster and onto ClickHouse after internal Hex dashboards started timing out and scheduled leaderboard aggregations competed with transactional trading traffic.
Choosing between vertical scaling and Postgres Read Replicas comes down to diagnosing the bottleneck first, using pg_stat_statements, read/write ratio queries, CPU utilization and EXPLAIN ANALYZE.
HighLevel replaced MySQL, Elasticsearch, Firestore and a document database with ClickHouse Cloud for lead activity, workflow logs, notifications and billing dashboards.
Shopify readies for Black Friday Cyber Monday with a year-long program that runs from March to October.
Datadog built file integrity monitoring on eBPF to capture file changes with process and container context, which periodic scans, inotify and auditd could not provide at scale.
Sharding Postgres early avoids the operational pain of large single instances, illustrated by an outage where stale planner statistics caused a 300 GB table to be sequentially scanned.
Hud, a runtime code sensor that tracks function-level behavior in production, moved its telemetry enrichment pipeline from a Node.js service plus Redis state machine into ClickHouse Cloud itself.
Modal powers three customer-facing observability dashboards (function scaling, per-call timeline, latency percentiles) from a single ClickHouse Cloud table ingesting 1–2 million events per minute and holding ~500 billion logs.
Netflix's logging system ingests 5 PB/day (10.6M events/s average, ~5 KB each) with ClickHouse as the hot tier and Apache Iceberg for long-term storage, making logs searchable within about 20 seconds.
GitLab moved its user-facing product analytics from Postgres to ClickHouse after dashboards repeatedly hit its 15-second performance ceiling.
Meta scaled its Express Backbone (EBB), the DC-to-DC WAN, by 10x using three techniques: pre-built DC metro fiber rings with POPs, IP platform scaling (scaling up via larger chassis and 800G interfaces, scaling out via more planes or more devices per plane), and IP/optical integration with 800G ZR pluggables that eliminate standalone transponders and cut aggregate power by 80-90%.
Meta's infrastructure grew from a LAMP stack with per-university databases to a global fleet of millions of machines.
ClickHouse Cloud's parallel replicas feature spreads a single GROUP BY query across every core of every node in a service, with no pre-aggregation or data reshuffling.
Exabeam runs its security analytics platform on ClickHouse Cloud across 10 regions, ingesting up to 1.2M events/sec per region (80B+ daily, 3.5 PB raw compressed to 200 TiB), with compute-compute separation that isolates write, merge and read nodes.
Character.AI consolidated fragmented logging across multi-cloud Kubernetes GPU clusters onto ClickStack (HyperDX UI) backed by ClickHouse Cloud.
Datadog cut real-time process and container metric traffic by about 100x by enabling 2-second live collection only on hosts whose processes a user is actually viewing (at most 50 per user), instead of on every host in the tenant.
Klaviyo replaced a Python-orchestrated segmentation engine built on MySQL and a large Cassandra cluster of pre-aggregated counters with a 192-node on-prem ClickHouse cluster.
Neon's May and June 2025 incidents were caused by a load surge from agentic AI platforms.
Hugging Face moved 500,000 repositories and about 20 PB from Git LFS to its Xet content-addressed storage with almost no user disruption.
Lansweeper moved its asset-analytics layer from MongoDB plus Elasticsearch to self-hosted ClickHouse and then to ClickHouse Cloud as it grew to 50M assets, 1.4B software records and 5.5B vulnerabilities.
Tesla built Comet, an in-house metrics platform that stores Prometheus-style time series in ClickHouse and keeps full PromQL compatibility.
Hugging Face's hosted MCP server at hf.co/mcp runs in production on Streamable HTTP in a stateless, direct-response configuration.
OpenAI ingests petabytes of logs daily, growing over 20% monthly, into a ClickHouse cluster of 90 shards with two replicas each, fed by Fluent Bit agents.
Zalando's ZEOS builds replenishment recommendations by minimising a cost function that combines storage, lost sales, overstock, operations and inbound costs.
ClickHouse's internal LogHouse platform grew from 19 PiB to over 100 PB of uncompressed logs (about 500 trillion rows), mostly by replacing the OpenTelemetry pipeline for ClickHouse server telemetry with SysEx.
Turso's Go API proxy, which maps database URLs to physical servers, ran out of memory as customers created millions of databases programmatically.
A query plan change overloaded Neon's control plane database in AWS us-east-1, which stopped it from suspending idle databases.
Scaling a SignalR chat app across multiple Heroku dynos takes two pieces: a Redis backplane so every instance relays hub messages to its own connected clients, and sticky sessions so long-lived WebSocket connections stay pinned to one dyno.
Kami's Postgres event tracking (Rails writing JSONB rows, queried via Redash) collapsed when COVID pushed weekly events from about 80M to nearly 2B.
ClickHouse Cloud replaced rolling-restart vertical scaling with Make-Before-Break (MBB) scaling: new, correctly sized replicas are added before old ones are removed.
Poizon moved its distributed-tracing observability store, which ingests petabytes of trace data daily, from self-hosted single-replica ClickHouse on cloud disks to ClickHouse Enterprise Edition on Alibaba Cloud.
Etsy calculates marketplace tax by calling Vertex's tax engine: a Quotation Request SOAP call when items are added to cart, and DistributeTaxRequest calls at order creation, cancellation and refund so Vertex's tax journal holds a complete record for reporting and remittance.
Nextdoor closes cache consistency gaps in its look-aside Redis cache by consuming the PostgreSQL change data stream and issuing version-conditional del_if_version deletes whenever writers fail to update the cache.
Letting product engineers manually choose replica vs. primary routing in Django broke down as abstractions hid read-after-write dependencies, and the common workaround of wrapping logic in transactions sent everything to the primary, slowly eroding the capacity gained from read replicas.
Nextdoor's Django/PostgreSQL backend outgrew the usual scaling fixes, and a move to distributed SQL was ruled out because multi-JOIN relational queries were spread across the codebase.
Hugging Face migrated its first model and dataset repositories from Git LFS to Xet storage, which uses content-defined chunking (~64 KB chunks aggregated into ~64 MB blocks) so that only changed bytes are uploaded.
Datadog runs hundreds of Kafka clusters with millions of partitions and built the Streaming Platform, a control layer that decouples producers and consumers from specific clusters through "Streams" spanning clusters, AZs and Kubernetes environments.
Zalando put a Route Server between its Skipper ingress proxies and the Kubernetes API after roughly 180 Skipper instances per cluster, each polling Ingresses and RouteGroups, overloaded etcd and throttled the API server.
A Remix and PostgreSQL job board on Railway is scaled up with a staging environment tied to a `stage` branch, automatic vertical scaling, and horizontal replicas.
Benchling replaced its PostgreSQL entity-attribute-value (EAV) storage for schema field values with a single JSONB column per entity, cutting row counts and per-row overhead that had slowed automated assay-result ingestion.
Lambda's per-instance database connections can overwhelm Aurora Serverless v2 during traffic spikes, causing connection exhaustion, lingering zombie connections and cold-start latency, and RDS Proxy adds cost, pinning issues and borrow latency without fully fixing it.
Meta logs every operation in FBCrypto, its managed cryptographic library, without sampling by aggregating identical events into per-event counts in an in-process buffer and flushing them periodically to Scribe, with data landing in Scuba and Hive.
Figma's AI search embeds frames and published components with a CLIP-based multimodal model, so screenshots, layer selections and text all query one vector space.
Slack evolved its Chef setup for tens of thousands of EC2 instances from a single stack, where every cookbook change hit all environments at once on the hour, into multiple sharded Chef stacks with versioned cookbook rollouts.
Datadog replaced its timeseries index, which auto-generated materialized indexes from a log of slow queries, with an inverted index that unconditionally indexes every metric;tag pair, much like search engines map words to documents.
ClickHouse Cloud's Azure data plane reuses its CSP-neutral design (AKS, Blob Storage, VNETs, Entra ID, managed Cilium) but had to adapt to several Azure-specific constraints.
Trip.com replaced its Elasticsearch-based centralized logging platform with ClickHouse after hitting stability, ingestion and cost limits at 4PB, and has since grown it toward 50PB.
GitHub replaced RepositoryPushJob, a single sequential background job that ran over 60 push-handling tasks from 20 services, with a Kafka push event fanned out to roughly 16 independently owned, parallel jobs.
Render's request routers evolved from per-instance in-memory caches with 5-minute TTLs and database lookups on miss, which overloaded PostgreSQL on every redeploy and failed during database downtime, to push-based caching using PostgreSQL LISTEN/NOTIFY so routers never query the database in the hot path.
Figma rebuilt LiveGraph, its real-time GraphQL-like subscription service over Postgres, to scale reads and database update load 100x as the database moved from one instance to vertical and horizontal shards.