Apache Beam
Unified Data Processing with Apache Beam
I am Solution Architect !
I tweet politics at @rajrakesh2690
Tech Stuffs on Medium at @raj.rakesh
Hello !
What is Apache Beam ?
Unified programming model for expressing efficient
and extensible, portable data processing pipelines.
Apache Beam
Batch
Streaming
Apache Beam - Unified
Single programming model for both batch and
stream data processing.
Apache Beam - Portable
Execute data processing pipeline on multiple
runtime environments.
“Write Once, Run anywhere”
Apache Beam - Extensible
Write and share new SDK’s, IO connectors and
transformation libraries.
Apache Beam : Open source Data Processing APIs
Apache Beam: Evolution
MapReduce
Colossus
Megastore
Millwheel
BigTable
Pub/Sub
Flume
Dremel
Spanner
Cloud Dataflow
Apache
Beam
Batch Processing
Stream Processing
Google Cloud
Dataflow
Apache Flink
Apache Spark
Direct Pipeline
Beam Model & SDK
Multiple
Modes
One
Pipeline
Many
Runtimes
Local or
Cloud
Local
Cloud
Beam Model - Flexibility
Beam Model -Generations beyond MapReduce
Batch
Stream
Beam Model
Pipeline
PTransform
PCollection (Bounded or Unbounded)
Source
Sink
A Simple batch Pipeline
with beam.pipeline as p:
lines = p | 'read' >> beam.io.ReadFromText(‘/path/to/files’)
words = line | ‘LinetoWord’ >> beam.FlatMap(lambda line : re.findall(‘\w+’, line) )
totals = words | ‘WordCount’ >> count()
totals | ‘WriteOutput’ >> beam.io.WriteToText(‘path/to/output’)
totals | ‘Top100’ >> CombinePerKey(Largest(100))
| ‘WriteTop100’ >> beam.io.WriteToText(‘path/to/another/output’)
Transformations
Source
Sink
Sink
Transformations
A Simple streaming Pipeline
with beam.pipeline as p:
lines = p | 'read' >> beam.io.ReadPubSub(..).WindowInto(...)
words = line | ‘LinetoWord’ >> beam.FlatMap(lambda line : re.findall(‘\w+’, line) )
totals = words | ‘WordCount’ >> count()
totals | ‘WriteOutput’ >> beam.io.WriteToText(‘path/to/output’)
totals | ‘Top100’ >> CombinePerKey(Largest(100))
| ‘WriteTop100’ >> beam.io.WriteToText(‘path/to/another/output’)
Transformations
Source
Sink
Sink
Transformations
Only code Change
Beam Model : Asking the Right Questions
What results are calculated ?
Where in event time the results are calculated ?
When in processing time the results are materialized ?
How do refinements of results relate ?
Event Time vs Processing Time
Classic Batch : What results are calculated ?
Windowed Batch : Where in event time results are calculated ?
Streaming : When in processing time results are materialized ?
Customizing: What Where When How
1. Classic Batch
2. Windowed Batch
3. Streaming & Accumulation
Beam - Built-in I/O Connectors
Usage
Beam python SDKs is growing fast to provide support to all kind of data storage systems.
Sample Beam Pipeline - On Cloud Dataflow
Sample Beam Pipeline - On Cloud Dataflow
What does Apache Beam Provide ?
Questions ?
Thank You !