Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 9 min read Case study mediumAdept

Migrating Data Ingestion Systems at Meta Scale

Meta migrated tens of thousands of MySQL-to-warehouse change data capture (CDC) ingestion jobs, together moving several petabytes daily, from customer-owned pipelines to a self-managed warehouse service, and fully retired the legacy system. Each job went through shadow, reverse-shadow and cleanup phases, with promotion gated on matching row counts and checksums plus no regression in landing latency or resource use. Because CDC carries bad data forward into new partitions, bad partitions were flagged in metadata to halt delta landing or fall back to older target partitions, and backfills gave early rollback signals. Automated promotion/demotion tooling, batch selection that excluded jobs with known issues, and reuse of legacy snapshots cut expensive full dumps under limited capacity.

Assumes: change data capturedata warehouse partitionsshadow testing

Related posts

  • Capturing Every Change From Shopify’s Sharded Monolith

    Shopify Engineering mediumAdept

    Shopify is replacing Longboat, its query-based change-data capture tool that polls MySQL replicas on an updated_at column, with a log-based CDC platform built on Debezium, Kafka Connect and Kafka that reads the binlog from 100+ MySQL shards. Polling caps data freshness at about an hour and cannot capture hard deletes, intermediate row states, or updates that skip updated_at. It also produces snapshots with mismatched high-water marks. The new design merges per-shard Debezium output into one Kafka topic per logical table, so a single CDC pipeline can serve both the internal data warehouse and the merchant analytics platform with near-real-time change events.

  • Evolving the Backend Storage for Platform Metrics

    Heroku Engineering mediumAdept

    Heroku migrated the time-series store behind MetaaS, its internal metrics service, from self-managed Apache Cassandra to AWS DynamoDB without user-visible impact. MetaaS ingests a couple hundred thousand observations per second into Kafka and aggregates them with stream-processing jobs, writing tens of thousands of points per second to the database. The migration used parallel dual-writes from Kafka and GitHub Scientist-style shadow reads, ramped to 100% of traffic, to catch edge cases. TTL-based retention meant no data backfill was needed: they waited for old Cassandra data to expire, then incrementally cut reads over. p99 query latency dropped from a variable 20–80 ms to a steady 15 ms, and costs fell.

  • Data logs: The latest evolution in Meta’s access tools

    Meta Engineering mediumAdept

    Meta serves per-user data logs from its Hive data warehouse, which cannot handle per-user point queries, by batching many Download Your Information requests into one full-table scan. A scheduled job collects recent requests into a batch run on the Core Workflow Service. It writes the requester IDs to a Hive table, then runs per-table and per-partition Dataswarm jobs that INNER JOIN against each table's owner column. PySpark splits the results into per-user files, and a Hack post-processing step applies privacy filters and renders readable HTML. Lessons include checkpointing for resilience against out-of-memory and timeout failures, a user-ID verification step added after a Spark partitioning bug nearly returned data to the wrong user, and an experimentation platform for testing workflow changes.

  • How SewerAI is using ClickHouse to modernize sewer management at scale

    ClickHouse mediumAdept

    SewerAI replicates its Postgres transactional data into ClickHouse via CDC (moving from Confluent/Debezium to self-hosted Debezium+Kinesis to PeerDB, and now ClickPipes) and uses materialized and refreshable materialized views to denormalize 40+ tables into a single hundreds-of-billions-row "Megatable" for real-time municipal analytics. Bulk customer operations caused update failures and backlogs because compute was always near its limit. The fixes were incremental refreshes over only the last ~70 seconds of data, projections on clean tables, dictionaries instead of LEFT ANY joins, join ordering, LIMIT instead of DISTINCT, and filtering before joins, which alone gave about 3x speed at half the compute. With these changes, data volume tripled and read/write operations rose tenfold while compute usage stayed flat.

  • Taking the fear out of migrations

    incident.io mediumAdept

    Data model migrations can be made low-risk with a four-step playbook: create the new model, dual-write to old and new (backfilling dependent and existing data with rerunnable jobs), read from both and alert on mismatches before switching reads behind a feature flag, then stop writing to and drop the old model. incident.io walks through the pattern using its move from hard-coded string incident statuses to a per-organisation incident_statuses table. Every step before dropping the old writes is reversible, so nothing has to be rushed and the read cutover can be undone with a feature flag. Simple migrations still finish in half a day to a day, and the work can be split across several engineers once the schema exists.

The quest for software engineering knowledge.

Look:
Layout: