Dataflow
1. What is Dataflow?
Google Cloud Dataflow
Dataflow is a fully managed service used to process and transform large amounts of data.
In simple words:
Dataflow takes data from one place, processes it, transforms it, and sends it to another place.
Imagine a banking application.
Every second, thousands of transactions happen.
You receive data like this:
Transaction | Amount | Status |
|---|---|---|
T101 | 500 | SUCCESS |
T102 | 1000 | FAILED |
T103 | 2000 | SUCCESS |
T104 | 300 | SUCCESS |
You want to:
Filter failed transactions.
Calculate total successful payments.
Group transactions by city.
Send processed data to BigQuery.
Dataflow can perform these operations automatically as part of a data pipeline.
Raw Data
Imagine Kafka receives:
This is raw data.
Processing = Modifying the Data
1. Filtering
Remove unwanted records.
Before:
2. Transforming
Change the format.
Before:
3. Enriching
Add extra information.
Before:
4. Aggregating
Calculate totals.
Before:
5. Validating
Remove bad data.
Before:
In Your Spring Boot Experience
This code is "processing":
You're:
- validating
- calculating fee
- enriching merchant data
That's data processing.
Then Where Does BigQuery Come?
After processing:
Stored Data:
| txnId | amount | merchant | fee |
|---|---|---|---|
| 101 | 5000 | Amazon | 50 |
| 102 | 2000 | Flipkart | 20 |
Now BigQuery is used to ask questions:
Dataflow = Chef cooks the food 🍳
Big Query = Customer eats and analyzes the food 📊
Dataflow changes the data. Big Query asks questions on the data. That's the core difference.
2. How does Dataflow work?
Think of a water-filter machine.
Input: Dirty water.
Processing: Filter the water.
Output: Clean water.
Dataflow works similarly.
Input: Raw data.
Processing: Filter, transform and enrich data.
Output: Clean, processed data.
3. Two important processing types
This is very important for your GCP certification.
Dataflow supports two processing modes.
A. Batch Processing
Batch means processing a collection of data together.
Example:
A bank has 10 lakh transactions from yesterday.
You want to generate a daily report.
Instead of processing each record immediately, you process the collected records together.
Real-world examples:
Daily transaction reports.
Monthly salary processing.
Historical customer data analysis.
Daily sales reports.
Remember: Batch = Process collected data together.
B. Stream Processing
Stream means processing data continuously as it arrives.
Example:
A customer makes a payment of ₹500.
The transaction event arrives in the system, and Dataflow can process it immediately without waiting for the end of the day.
Real-world examples:
Real-time payment monitoring.
Fraud detection pipelines.
IoT sensor monitoring.
Live transaction dashboards.
Remember: Stream = Process incoming data continuously.
Batch vs Stream
Batch | Stream |
|---|---|
Processes collected data | Processes continuous incoming data |
Scheduled or triggered | Continuously running |
Daily reports | Real-time monitoring |
Historical analysis | Live analytics |
4. How does Dataflow work with other Google Cloud services?
Your course mentions several services. Let's understand their roles.
Service | What it does |
|---|---|
Pub/Sub | Receives and distributes messages |
Apache Kafka | Event streaming and messaging |
Datastore | Stores application data |
Dataflow | Processes and transforms data |
BigQuery | Analyses processed data |
Bigtable | Stores large-scale, low-latency data |
Vertex AI | Builds and runs AI/ML applications |
Looker Studio | Creates dashboards and reports |
Note: Your lecture says Agent Platform and Data Studio; these refer to Google's AI platform and dashboard ecosystem.
5. What is Apache Beam?
This is an important concept.
You heard this in your lecture:
Dataflow supports Java and Python APIs through the Apache Beam SDK.
Let's understand.
Apache Beam is a programming model used to create data processing pipelines.
Google Dataflow is one of the services that can execute those pipelines.
Think of it like this:
Apache Beam = Instructions or recipe.
Dataflow = Machine that executes the recipe.
Apache Beam SDK
Write pipeline using Java / Python
Google Cloud Dataflow
Executes and manages the pipeline
Processed Data
As a Java developer
You can write Dataflow pipelines using Java.
For example:
Pipeline pipeline = Pipeline.create(options);
pipeline
.apply(TextIO.read().from("input.txt"))
.apply(Filter.by(line -> line.contains("SUCCESS")))
.apply(TextIO.write().to("output"));
pipeline.run();What does this code do?
Creates a pipeline.
Reads data from a text file.
Filters records containing
SUCCESS.Writes the filtered records to an output file.
Runs the pipeline.
This is an introductory Apache Beam example using Java.
6. What is autoscaling in Dataflow?
Imagine your pipeline normally receives 1,000 records per second.
Suddenly, it receives 1 lakh records per second.
Without sufficient processing capacity, the pipeline may become slow.
Dataflow can automatically increase or decrease worker resources based on workload and configuration.
Low workload → Fewer workers.
High workload → More workers.
Workload decreases → Workers can scale down.
This reduces the need to manually manage infrastructure.
7. What is monitoring in Dataflow?
Dataflow integrates with Google Cloud Observability.
You can monitor:
Pipeline errors.
Processing delays.
Worker utilisation.
Data throughput.
Failed records and job status.
You can configure alerts to notify you when something goes wrong.
8. BigQuery vs Dataflow – Important difference
Since we just studied BigQuery, let's compare them.
BigQuery | Dataflow |
|---|---|
Data warehouse | Data processing service |
Stores and analyses data | Transforms and processes data |
Executes SQL queries | Executes data pipelines |
Analytical reports | Batch and streaming pipelines |
Simple example:
Dataflow cleans and transforms transaction data.
BigQuery stores the processed data and helps you analyse it.
They work together.




Comments
Post a Comment