the flink big data analytics platform
play

The Flink Big Data Analytics Platform Marton Balassi, Gyula Fora - PowerPoint PPT Presentation

The Flink Big Data Analytics Platform Marton Balassi, Gyula Fora {mbalassi, gyfora}@apache.org What is Apache Flink? Open Started in 2009 by the Berlin-based database research groups Source In the Apache Incubator since mid 2014 61


  1. The Flink Big Data Analytics Platform Marton Balassi, Gyula Fora � {mbalassi, gyfora}@apache.org

  2. What is Apache Flink? Open • Started in 2009 by the Berlin-based database research groups Source • In the Apache Incubator since mid 2014 • 61 contributors as of the 0.7.0 release Fast + • Fast, general purpose distributed data processing system • Combining batch and stream processing Reliable • Up to 100x faster than Hadoop Ready to • Programming APIs for Java and Scala use • Tested on large clusters 11/18/2014 Flink - M. Balassi & Gy. Fora 2

  3. What is Apache Flink? Analytical Program Worker Flink Client & Master Op0mizer Worker Flink Cluster 11/18/2014 Flink - M. Balassi & Gy. Fora 3

  4. This Talk • Introduction to Flink • API overview • Distinguishing Flink • Flink from a user perspective • Performance • Flink roadmap and closing 11/18/2014 Flink - M. Balassi & Gy. Fora 4

  5. Open source Big Data Landscape Hive Cascading Applica3ons Mahout Pig Crunch MapReduce Flink Data processing engines Spark Tez Storm App and resource Yarn Mesos management KaCa Storage, streams HDFS HBase … 11/18/2014 Flink - M. Balassi & Gy. Fora 5

  6. Flink stack Apache Python Graph API MRQL API („Spargel“) Scala API Java API Java API (batch) (streaming) (batch) Common API Batch Flink Op0mizer Streams Builder Streaming Java Apache Hybrid Batch/Streaming Run0me Collec0ons Tez Storage Rabbit Files S3 Azure KaCa Redis HDFS JDBC … MQ Streams Local Cluster Na0ve YARN EC2 Execu0on Manager 11/18/2014 Flink - M. Balassi & Gy. Fora 6

  7. Flink APIs

  8. Programming model Data abstractions: Data Set, Data Stream Program DataSet/Stream DataSet/Stream DataSet/Stream Y X A C B Operator X Operator Y Parallel Execution A (1) A (1) X B (1) B (1) Y C (1) C (1) A (2) A (2) X B (2) B (2) Y C (2) C (2) 11/18/2014 Flink - M. Balassi & Gy. Fora 8

  9. Flexible pipelines Map, FlatMap, MapPartition, Filter, Project, Reduce, ReduceGroup, Aggregate, Distinct, Join, CoGoup, Cross, Iterate, Iterate Delta, Iterate-Vertex-Centric, Windowing Iterate Source Map Reduce Join Reduce Sink Map Source 11/18/2014 Flink - M. Balassi & Gy. Fora 9

  10. WordCount, Java API DataSet< String > text = env.readTextFile(input); DataSet< Tuple2<String, Integer> > result = text .flatMap((str, out) -> { for (String token : value.split("\\W")) { out.collect(new Tuple2<>(token, 1)); }) .groupBy(0) .sum(1); 11/18/2014 Flink - M. Balassi & Gy. Fora 10

  11. WordCount, Scala API val input = env.readTextFile(input); val words = input flatMap { line => line.split("\\W+") } val counts = words groupBy { word => word } count() 11/18/2014 Flink - M. Balassi & Gy. Fora 11

  12. WordCount, Streaming API DataStream< String > text = env.readTextFile(input); DataStream< Tuple2<String, Integer> > result = text .flatMap((str, out) -> { for (String token : value.split("\\W")) { out.collect(new Tuple2<>(token, 1)); }) .groupBy(0) .sum(1); 11/18/2014 Flink - M. Balassi & Gy. Fora 12

  13. Is there anything beyond WordCount? 11/18/2014 Flink - M. Balassi & Gy. Fora 13

  14. Beyond Key/Value Pairs // outputs pairs of pages and impressions class Impression { class Page { public String url; public String url; public long count; public String topic; } } DataSet <Page> pages = ...; DataSet <Impression> impressions = ...; DataSet <Impression> aggregated = impressions .groupBy("url") .sum("count"); pages.join(impressions).where("url").equalTo("url") .print() // outputs pairs of matching pages and impressions 11/18/2014 Flink - M. Balassi & Gy. Fora 14

  15. Preview: Logical Types DataSet <Row> dates = env.readCsv(...).as("order_id", "date"); DataSet <Row> sessions = env.readCsv(...).as("id", "session"); DataSet <Row> joined = dates .join(session).where("order_id").equals("id"); joined.groupBy("date").reduceGroup(new SessionFilter()) class SessionFilter implements GroupReduceFunction< SessionType > { public void reduce(Iterable< SessionType> value, Collector out){ ... public class SessionType { } public String order_id; } public Date date; public String session; } 11/18/2014 Flink - M. Balassi & Gy. Fora 15

  16. Distinguishing Flink

  17. Hybrid batch/streaming runtime • Batch and stream processing in the same system • No micro-batches, unified runtime • Competitive performance • Code reusable from batch processing to streaming, making development and testing a piece-of-cake 11/18/2014 Flink - M. Balassi & Gy. Fora 17

  18. Flink Streaming • Most Data Set operators are also available for Data Streams • Temporal and streaming specific operators – Window/mini-batch operators – Window join, cross etc. • Support for iterative stream processing • Connectors for different data sources – Kafka, Flume, RabbitMQ, Twitter etc. 11/18/2014 Flink - M. Balassi & Gy. Fora 18

  19. Flink Streaming //Build new model on every second of new data DataStream< Double[] > model= env .addSource(new TrainingDataSource()) .window(1000) .reduceGroup(new ModelBuilder()); //Predict new data using the most up-to-date model DataStream< Integer > prediction = env .addSource(new NewDataSource()) .connect(model) .map(new Predictor()); 11/18/2014 Flink - M. Balassi & Gy. Fora 19

  20. Lambda architecture Source: https://www.mapr.com/developercentral/lambda-architecture 11/18/2014 Flink - M. Balassi & Gy. Fora 20

  21. Lambda architecture in Flink 11/18/2014 Flink - M. Balassi & Gy. Fora 21

  22. Dependability • Flink manages its own memory • Caching and data processing happens in a dedicated memory fraction • System never breaks the 
 JVM heap, gracefully spills Unmanaged Heap User Code JVM Heap Hashing/Sor0ng/Caching Flink Managed Heap Shuffles/Broadcasts (next version unifies network buffers Network Buffers and managed heap) 11/18/2014 Flink - M. Balassi & Gy. Fora 22

  23. 
 
 
 Operating on � Serialized Data • serializes data every time 
  Highly robust, never gives up on you • works on objects, RDDs may be stored serialized 
  Serialization considered slow, only when needed • makes serialization really cheap: 
  partial deserialization, operates on serialized form 
  E ffi cient and robust! 11/18/2014 Flink - M. Balassi & Gy. Fora 23

  24. Operating on � Serialized Data Microbenchmark Sorting 1GB worth of (long, double) tuples • 67,108,864 elements • Simple quicksort • 11/18/2014 Flink - M. Balassi & Gy. Fora 24

  25. Memory Management public class WC { public String word; public int count; } empty page Pool of Memory Pages • Works on pages of bytes, maps objects transparently • Full control over memory, out-of-core enabled • Algorithms work on binary representation • Address individual fields (not deserialize whole object) • Move memory between operations 11/18/2014 Flink - M. Balassi & Gy. Fora 25

  26. Flink from a user perspective

  27. Flink programs run everywhere Local Debugging As Java Collec0on Programs Embedded Cluster (Batch) (e.g., Web Container) Cluster (Streaming) Fink Run3me or Apache Tez 11/18/2014 Flink - M. Balassi & Gy. Fora 27

  28. Migrate Easily Flink out-of-the-box supports • Hadoop data types (writables) • Hadoop Input/Output Formats • Hadoop functions and object model Input Map Reduce Output S Red Join DataSet DataSet DataSet Output Map DataSet DataSet Input 11/18/2014 Flink - M. Balassi & Gy. Fora 28

  29. Little tuning or configuration required • Requires no memory thresholds to configure – Flink manages its own memory • Requires no complicated network configs – Pipelining engine requires much less memory for data exchange • Requires no serializers to be configured – Flink handles its own type extraction and data representation • Programs can be adjusted to data automatically – Flink’s optimizer can choose execution strategies automatically 11/18/2014 Flink - M. Balassi & Gy. Fora 29

  30. Understanding Programs Visualizes the operations and the data movement of programs Analyze after execution Screenshot from Flink’s plan visualizer 11/18/2014 Flink - M. Balassi & Gy. Fora 30

  31. Understanding Programs Analyze after execution (times, stragglers, …) 11/18/2014 Flink - M. Balassi & Gy. Fora 31

  32. Iterations in other systems Loop outside the system Client Step Step Step Step Step Loop outside the system Client Step Step Step Step Step 11/18/2014 Flink - M. Balassi & Gy. Fora 32

  33. Iterations in Flink Streaming dataflow 
 with feedback red. join map join System is iteration-aware, performs automatic optimization 11/18/2014 Flink - M. Balassi & Gy. Fora 33

  34. Automatic Optimization for Iterative Programs Pushing work 
 Maintain state as index Caching Loop-invariant Data „out of the loop“ 11/18/2014 Flink - M. Balassi & Gy. Fora 34

  35. Performance

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend