Aller au contenu
Londres, Royaume-Uni · Fondé en 1994
Français

Unit 3: Processing Big Data

How work is shared across many machines, the difference between batch and stream processing, and how data pipelines move, transform and check data reliably.

Unit 3 of 5 · about 54 minutes

3.1 Distributed processing

Storing huge datasets across many machines solves one problem but creates another: how do you analyse data that no single computer can hold? The answer is distributed processing, in which a large job is split into many smaller tasks that run at the same time on different machines, and the partial results are then combined. This idea, called parallel processing, underpins almost all big data technology.

An everyday analogy

Imagine counting the votes in a large election. One person counting every ballot would take weeks. Instead, ballots are divided among many counting tables. Each table counts its own pile and reports totals for each candidate. A central team then adds the totals together. The work finishes quickly because the piles are counted in parallel, and the central team only handles small summaries rather than every ballot. Distributed data processing follows the same pattern.

MapReduce: the original pattern

An influential early approach was called MapReduce. It breaks a job into two main phases:

  1. Map. Each machine processes its own portion of the data and produces intermediate results. In the election example, each table produces counts per candidate for its pile.
  2. Shuffle. Intermediate results are grouped so that all results for the same key, such as the same candidate, end up together.
  3. Reduce. The grouped results are combined into final answers, such as the total votes per candidate.

A key principle is to move the computation to the data, not the data to the computation. Because data is spread across machines, it is far more efficient to send small programs to where the data already sits than to copy huge files across the network.

Modern processing engines

MapReduce wrote intermediate results to disk at each step, which made complex, multi-step analyses slow. Later engines, of which Apache Spark is the most widely known open-source example, keep more data in memory between steps and offer a richer set of operations. They also let analysts work in familiar languages, including SQL and Python, while the engine handles the distribution of work behind the scenes. Many cloud data warehouses and lakehouse platforms apply similar parallel processing internally, so users can write ordinary SQL queries that run across many machines without having to manage a cluster.

What makes distributed processing hard

  • Data movement. Steps that require shuffling large amounts of data between machines, such as joining two big tables, are often the slowest and most expensive parts of a job.
  • Skew. If data is unevenly distributed, for example one customer has far more transactions than all others, one machine may receive much more work and delay the whole job.
  • Failures. In a large cluster, some machine is likely to fail during a long job. Processing engines are designed to rerun failed tasks automatically, but this adds complexity.
  • Cost control. In the cloud, processing power is easy to add, which means poorly written queries can quietly generate large bills.

Remember: Distributed processing is powerful but not free. Many analyses run perfectly well on a single machine, and using a cluster for small data adds cost and complexity without benefit.

When you need distributed processing

A practical rule of thumb is to start simple. If data fits comfortably on a single modern computer and analyses run in acceptable time, a spreadsheet, a single database or a desktop analysis tool may be the right choice. Distributed processing becomes worthwhile when data is too large for one machine, when analyses take too long to be useful, or when many users need to query large shared datasets at the same time. Modern single-machine tools have become very capable, so the threshold is higher than many people assume.

In practice

As a non-specialist, you can contribute to processing decisions by asking about scale and cost rather than technology. How large is the data, and how quickly is it growing? How long does the current analysis take, and how fast does it need to be? Who will run queries, and how often? What controls exist to prevent unexpectedly expensive jobs, such as budgets, alerts or limits on query size? A data team that can answer these clearly is likely to choose sensibly between a simple setup and a distributed platform, and to avoid paying for capacity the organisation does not need.

3.2 Batch and stream processing

Data can be processed in two broad ways. Batch processing collects data over a period and processes it all together at scheduled times, such as every night. Stream processing handles data continuously, event by event or in small groups, as it arrives. Most organisations need both, and choosing well depends on how quickly decisions need to be made.

Batch processing

Batch processing is the traditional and still most common approach. A typical example is a nightly job that takes the day's sales from every shop, cleans them, adds them to the warehouse and refreshes the next morning's reports. Batch processing is efficient for large volumes, relatively simple to build and test, and easy to rerun if something goes wrong. Its limitation is delay: results are only as current as the last run.

Batch suits payroll, monthly financial reporting, historical analysis, training machine learning models on past data and any decision that does not need up-to-the-minute information.

Stream processing

Stream processing works on data in motion. Events, such as a card payment, a website click or a sensor reading, are captured as they happen and passed through a system that analyses them within seconds or less. Streaming systems usually include:

  • Producers, the systems or devices that generate events;
  • A messaging or event platform, which receives events, stores them temporarily in order and makes them available to consumers. Apache Kafka is a widely used open-source example;
  • Stream processors, which filter, combine, summarise or score events as they flow;
  • Consumers, such as alerting systems, dashboards or databases that act on or store the results.

Stream processing suits fraud detection, monitoring equipment, live logistics tracking, personalising a website during a visit and detecting security threats.

Windows and time

Because a stream never ends, questions such as "how many orders have we received?" need to be bounded. Stream processors use windows, such as counting orders in each five-minute period. Time is also trickier than it sounds. An event has the time it happened and the time it arrived, and these can differ if a device was offline. Well-designed streaming systems account for late and out-of-order events so that results remain accurate.

AspectBatch processingStream processing
TimingScheduled, for example hourly or nightlyContinuous, as events arrive
Delay before resultsMinutes to hoursSeconds or less
ComplexityLower; easier to test and rerunHigher; must handle late, duplicate and missing events
Typical usesReporting, historical analysis, model trainingFraud alerts, monitoring, live personalisation

Tip: Before asking for real-time data, ask how quickly anyone could actually act on it. If a manager reviews a report once a day, a nightly batch may be perfectly adequate, and far cheaper, than a streaming system.

Combining batch and stream

Many architectures combine both approaches. A retailer might stream point-of-sale events to update stock levels and flag suspicious refunds immediately, while also running a nightly batch to produce reconciled financial figures. Some modern platforms treat batch as a special case of streaming, processing historical data and live data with the same code, which reduces duplication. Whatever the design, it is important that both routes produce consistent numbers, or users will lose trust when a live dashboard and a morning report disagree.

Common mistakes

Typical errors include building streaming systems for problems that do not need them, underestimating the effort of running streaming infrastructure around the clock, failing to handle duplicate events so that totals are inflated, and forgetting to monitor delays so that a "real-time" dashboard silently falls hours behind. A further mistake is to give streaming results to people who have no process for responding to them, so that alerts arrive instantly but are acted upon only the next day.

In practice

For each analytics need in your area, note how quickly a decision must follow the underlying event: seconds, minutes, hours or days. Group needs accordingly. Seconds and minutes may justify streaming; hours and days usually suit batch. Then check whether anyone is available to act at that speed. This simple exercise helps prevent over-engineering and focuses investment where speed genuinely creates value.

3.3 Data pipelines and data quality

A data pipeline is a series of automated steps that moves data from where it is created to where it is used, transforming and checking it along the way. Pipelines are the plumbing of big data. When they work well, nobody notices them; when they fail, reports are wrong, dashboards go blank and decisions are made on bad information.

ETL and ELT

Two common patterns describe the order of the main steps:

  • ETL (extract, transform, load): data is extracted from source systems, transformed into the required shape on a separate processing system, and then loaded into the warehouse. This was the traditional approach when warehouse processing power was expensive.
  • ELT (extract, load, transform): data is extracted and loaded in raw form into a lake, warehouse or lakehouse, then transformed there using its own processing power. This has become common with scalable cloud platforms, because it keeps raw data available and lets transformations be changed and rerun.

Typical transformations

  1. standardising formats, such as dates, currencies, units and capitalisation;
  2. removing or flagging duplicates;
  3. handling missing values, for example by leaving them blank, filling them using a documented rule or excluding records;
  4. joining data from different sources using shared keys;
  5. applying business rules, such as how revenue is calculated or which customers count as active;
  6. aggregating detailed data into summaries;
  7. masking or removing personal information that is not needed for analysis.

Orchestration and monitoring

Pipelines often involve many steps that must run in the right order, at the right time and only when earlier steps have succeeded. Orchestration tools schedule and coordinate these steps, retry failures and alert engineers when something goes wrong. Good pipelines also record lineage: where each dataset came from and which transformations were applied. Lineage makes it possible to trace a strange figure in a report back to its source, and to understand what will be affected if a source system changes.

Dimensions of data quality

Data quality is often assessed along several dimensions:

  • Accuracy: does the data correctly describe reality?
  • Completeness: are required values present?
  • Consistency: do values agree across systems and over time?
  • Timeliness: is the data up to date enough for its purpose?
  • Validity: do values follow agreed formats and rules, such as valid postcodes?
  • Uniqueness: is each real-world item recorded only once?

Automated tests in pipelines can check many of these, for example confirming that every order has a customer, that totals fall within expected ranges, and that today's data has actually arrived.

Remember: Fixing data quality at the source is almost always better than repeatedly cleaning it downstream. If a form allows invalid entries, correcting the form saves effort in every report that uses the data.

When pipelines break

Common causes of pipeline failure include changes in source systems, such as a renamed field; unexpected data, such as a new product category; late-arriving files; and capacity problems when volumes grow. Silent failures are the most dangerous: a pipeline that runs successfully but loads incomplete data can mislead users for weeks. This is why monitoring should check data, not just whether jobs completed.

Data contracts

Many pipeline problems begin when a team changes a source system without realising that others depend on its data. Some organisations address this with data contracts: written agreements between the teams that produce data and the teams that use it. A contract describes which fields will be provided, their meaning and format, how often data will arrive and how much notice will be given before changes. Even an informal version, such as a shared document and a habit of announcing changes in advance, prevents many failures.

In practice

Pick a report or dashboard you use regularly. Ask the team that maintains it three questions: where does the data come from, what transformations are applied, and what checks would catch a problem? Then consider what you would notice if the data were incomplete. Encouraging reports to show when data was last refreshed and whether quality checks passed is a simple, valuable step that any manager can request.

Case study: Fixing inflated sales figures at an online bookseller

Pagewell Books, a fictional online bookseller, noticed that its live sales dashboard regularly showed higher daily totals than the finance team's reconciled figures the next morning. Managers began to distrust both.

The data team traced the problem using lineage records. Order events were streamed from the website to the dashboard, but when the payment system was slow, the website sometimes resent an event, and the streaming process counted it twice. The nightly batch pipeline, by contrast, deduplicated orders using a unique order number before loading them into the warehouse.

The team added the same deduplication rule to the streaming process and created an automated check comparing the dashboard's daily total with the warehouse figure, alerting engineers if they differed by more than a small margin. They also added a label on the dashboard showing when data had last updated and whether checks had passed. Within a month, the two figures matched closely, and managers resumed using the live dashboard for daily decisions on promotions.

Activity

Choose a report or dataset you rely on at work. Describe how data probably flows from its sources into the report, and decide whether batch or stream processing is appropriate. Then propose three automated data quality checks that would catch the most likely problems.

Compare with a model answer

A good answer sketches a realistic flow, such as orders from an e-commerce system and refunds from a payments system being extracted nightly, loaded into a warehouse and transformed into a weekly sales report. It justifies batch processing because managers review the report weekly and no one needs minute-by-minute updates.

It proposes specific, testable checks, for example: that the number of orders loaded each day falls within an expected range compared with recent days; that every refund links to an existing order; and that the data for the previous day has arrived before the report refreshes. The strongest answers also suggest showing the refresh time on the report and fixing a recurring quality problem at its source, such as a form that allows blank product codes.

Key takeaways

  • Distributed processing splits large jobs into tasks that run in parallel across many machines, moving computation to where the data is stored.
  • Modern engines keep more work in memory and let analysts use SQL and Python, but data movement, skew and cost still need managing.
  • Batch processing suits scheduled, large-volume work, while stream processing suits decisions needed within seconds; many organisations need both, producing consistent results.
  • ETL and ELT pipelines extract, load and transform data, with orchestration, lineage and monitoring keeping them reliable.
  • Data quality covers accuracy, completeness, consistency, timeliness, validity and uniqueness, and is best fixed at the source.

Unit check

Create a free account to answer the check, save your progress and receive your free certificate.

Create a free account Log in
← Unit 2 Unit 4 →
WhatsApp