Data Integration and the N² Problem

Maslow's Hierarchy of Data Needs

  1. Base: Capture all relevant data in uniform format
  2. Middle: Infrastructure for reliable data processing
  3. Top: Advanced modeling, analytics, prediction

Two Complications That Make This Hard

1. The Event Data Firehose — event data records things that happen (clicks, metrics, IoT) rather than things that are. This data is orders of magnitude larger than traditional OLTP volumes.

2. Explosion of Specialized Data Systems — modern infrastructure includes OLAP, Elasticsearch, Cassandra, Hadoop, graph analysis, Redis, monitoring/metrics. Each system needs data. Naive solution: connect every system to every other system = O(N²) pipeline problem.

Log-Structured Data Flow — The Solution

Architecture:

  1. Central Log — all organizational data flows through one central log
  2. Logical Data Sources — each source (application events, DB tables) modeled as its own log
  3. Subscribers — each downstream system reads the log at its own pace, applies records to its own store, advances its own offset

The log acts as "a kind of messaging system with durability guarantees and strong ordering semantics."

LinkedIn's Journey: From Databus to Kafka

Databus — LinkedIn's first attempt. A CDC service that read Oracle's internal transaction log and let other systems subscribe to row-level changes. It worked, but only solved one connection: Oracle → out.

DatabusKafka
Who producesOnly Oracle (via CDC)Any system
What it storesDB row changesAny message or event
RetentionShort cache windowConfigurable (days/weeks)
ReplayLimitedFull — rewind to any offset
Consumer modelSubscriptionConsumer groups with independent offsets
ThroughputBounded by OracleDesigned for millions/sec

The Breaking Point: Hadoop Project (2008)

LinkedIn tried to move recommendation processing into Hadoop. The plan: a few weeks to move the data, the rest of the time for algorithms. What actually happened: data movement consumed most of the project.

Three things became clear:

  1. Clean data in a new system creates outsized value. Just having data available in Hadoop made new products possible.
  2. Pipelines need structural support to be reliable. Define schema upfront; without schema discipline, every new source breaks something.
  3. Coverage was the actual bottleneck. Only a small fraction of LinkedIn's data was in Hadoop. Getting more in required a custom pipeline for every new source.

The N² → N Transformation

Before and after. Left: six systems, each wired directly to the others, fifteen custom pipelines. Right: the same six systems each make one connection to a central log, six connections in total.
Fifteen custom pipelines become six connections to one log The log does not make any single pipeline simpler — it changes how the count grows: adding a seventh system costs one connection instead of six new pipelines.

ETL: Why the Traditional Approach Breaks

The point: in the old setup, the warehouse pipeline was the only place data got cleaned, and its only output was the warehouse's format. That format suited the warehouse and nobody else.

Traditional ETL glues two different jobs into that one pipeline:

Job 1 — Cleaning the data: stripping out source-specific weirdness. Without a shared clean format, every consumer handles every source's weirdness on its own.

Job 2 — Reshaping for the warehouse: denormalizing, columnar conversion, pre-aggregation. This is warehouse-specific. Search doesn't need a star schema. A fraud model doesn't need daily rollups.

Job 1 in practice: what "cleaning" fixes

Raw sources are the systems where data is first written. Different teams built them at different times, so each one has its own quirks:

SourceQuirk
Orders DBAmount stored in paise (50000 means ₹500)
Users DBDates written as 02/10/26: is that 2 Oct or 10 Feb?
Product catalogCalls the field prod_id; orders call it productId
Reviews serviceDeleted reviews are still there, marked is_deleted = 1
Inventory serviceNo database to read, only an API that allows 100 calls a minute

Cleaning means fixing all of this: converting paise to rupees, using one date format, matching field names, dropping deleted rows and working within that API limit. Every consumer needs this done.

Job 2 in practice: one dish, cooked for the warehouse

Take three clean orders after Job 1:

OrderUserProductAmountCityTime
1017Shoes₹500Pune2 Oct 10:01
1029Shoes₹2,00,000Pune2 Oct 10:03
1037Watch₹800Delhi2 Oct 11:00

Job 2 does three things to these rows:

  • Denormalizing: joins in customer and product details so each row is complete. A star schema is the organized form of this: a central fact table (orders) with dimension tables (customer, product, date) around it.
  • Columnar conversion: stores data column by column (e.g. Parquet), so "sum all amounts" reads one column instead of every row.
  • Pre-aggregation: computes totals ahead of time, so dashboards don't rescan every order.

The output looks like this:

DayCityRevenue
2 OctPune₹2,00,500
2 OctDelhi₹800

That's perfect for an analyst asking "how much did Pune sell yesterday?" Hand it to anyone else and it's useless:

  • Fraud model: needs to see order 102 by itself, at 10:03, and ask why user 9 suddenly spent ₹2 lakh. In the daily table that order has vanished into "Pune ₹2,00,500", and the table arrives the next morning.
  • Search: needs one document per product, like "Shoes: in stock, sold 2 times". It has no use for revenue per city or a fact/dimension layout.

What the glue costs: the search team's choice

Search needs data from all 5 sources above. The warehouse team already wrote the cleaning code, but it lives inside their pipeline and only outputs warehouse tables. So search has two bad options:

  1. Take the warehouse format. Wrong shape, and up to a day late.
  2. Go back to the raw sources. Connect to all 5 itself (5 extractors), rewrite the same fixes (5 cleaners), and only then build its search documents.

The fraud team faces the same choice and writes the same cleaning code again. With M sources and N consumers you get about M × N pipelines: 5 sources × 3 consumers = 15. When the orders team switches from paise to rupees, every copy breaks separately.

The fix: split the pipeline at the point where data is clean but not yet shaped. Each source is cleaned once and published to the log. Each consumer reads clean data from the log and does only its own Job 2. That's 5 cleaners + 3 transforms = 8 pieces, and the warehouse becomes just one consumer among many.

The same glue causes four problems in day-to-day operations:

ProblemWhat it means in practice
Batch schedule gates everythingFraud detection needs data now. ETL runs at 2am. So you wait, or build a second pipeline.
One team is a bottleneckEvery system that wants clean data must ask the warehouse team. They can never keep up.
Producers don't see the impactThe team writing to the source DB never sees how downstream systems use their data. Schema changes silently break pipelines.
Every new system starts from scratchSearch, monitoring, fraud models — each needs clean data and builds its own extraction pipeline.

The Better Architecture: Split the Two Jobs

Source data is cleaned once into a canonical format and written to the central log. From the log, three consumers each do their own reshape: a warehouse transform feeds the warehouse, a search transform feeds Elasticsearch, and a real-time path feeds the fraud model.
Clean once at the source; let each destination do its own reshape The cleaning job is shared and done once; reshaping is never shared. Each consumer reshapes the clean log into the one shape it needs, so no consumer inherits another’s.
  1. At the source — clean and normalize into canonical format (lossless, reversible)
  2. In stream processors — enrich, join, sessionize for real-time use
  3. At the destination — aggregate and reshape for each system's specific query needs

Event-Driven Systems — The Same Pattern in Application Code

The same O(N²) → O(N) argument applies to application code. A job display page that calls five downstream services on every render has five reasons to change — and if the ads team deploys a bad build, the job page goes down.

✗ Before — page calls every downstream service

displayJob(jobId):
    renderPage()
    hadoop.send(jobId, userId, timestamp)
    scraping.countView(ip, jobId)
    posterAnalytics.aggregate(jobId)
    impressionCap.record(userId, jobId)
    recommendations.trackPopularity(jobId)

✓ After — publish one event, let consumers subscribe

displayJob(jobId):
    renderPage()
    log.publish("job-displayed",
      {jobId, userId, timestamp, ...})