Apache Flink

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Apache Flink
Apache Flink Logo.png
Developer(s) Apache Software Foundation
Stable release
1.5.0 / 25 May 2018
Written in Java and Scala
Operating system Cross-platform
Type Data analytics, machine learning algorithms
License Apache License 2.0
Website flink.apache.org

Apache Flink is an open source stream processing framework developed by the Apache Software Foundation. The core of Apache Flink is a distributed streaming dataflow engine written in Java and Scala.[1][2] Flink executes arbitrary dataflow programs in a data-parallel and pipelined manner.[3] Flink's pipelined runtime system enables the execution of bulk/batch and stream processing programs.[4][5] Furthermore, Flink's runtime supports the execution of iterative algorithms natively.[6]

Flink provides a high-throughput, low-latency streaming engine[7] as well as support for event-time processing and state management. Flink applications are fault-tolerant in the event of machine failure and support exactly-once semantics.[8] Programs can be written in Java, Scala,[9] Python,[10] and SQL[11] and are automatically compiled and optimized[12] into dataflow programs that are executed in a cluster or cloud environment.[13]

Flink does not provide its own data storage system and provides data source and sink connectors to systems such as Amazon Kinesis, Apache Kafka, HDFS, Apache Cassandra, and ElasticSearch.[14]

Development[edit]

Apache Flink is developed under the Apache License 2.0[15] by the Apache Flink Community within the Apache Software Foundation. The project is driven by over 25 committers and over 340 contributors.

data Artisans is a company that was founded by the original creators of Apache Flink.[16] 12 Apache Flink committers are currently employed by data Artisans.[17]

Overview[edit]

Apache Flink’s dataflow programming model provides event-at-a-time processing on both finite and infinite datasets. At a basic level, Flink programs consist of streams and transformations. “Conceptually, a stream is a (potentially never-ending) flow of data records, and a transformation is an operation that takes one or more streams as input, and produces one or more output streams as a result.”[18]

Apache Flink includes two core APIs: a DataStream API for bounded or unbounded streams of data and a DataSet API for bounded data sets. Flink also offers a Table API, which is a SQL-like expression language for relational stream and batch processing that can be easily embedded in Flink’s DataStream and DataSet APIs. The highest-level language supported by Flink is SQL, which is semantically similar to the Table API and represents programs as SQL query expressions.

Programming Model and Distributed Runtime[edit]

Upon execution, Flink programs are mapped to streaming dataflows.[18] Every Flink dataflow starts with one or more sources (a data input, e.g. a message queue or a file system) and ends with one or more sinks (a data output, e.g. a message queue, file system, or database). An arbitrary number of transformations can be performed on the stream. These streams can be arranged as a directed, acyclic dataflow graph, allowing an application to branch and merge dataflows.

Flink offers ready-built source and sink connectors with Apache Kafka, Amazon Kinesis, HDFS, Apache Cassandra, and more.[14]

Flink programs run as a distributed system within a cluster and can be deployed in a standalone mode as well as on YARN, Mesos, Docker-based setups along with other resource management frameworks.[19]

State: Checkpoints, Savepoints, and Fault-tolerance[edit]

Apache Flink includes a lightweight fault tolerance mechanism based on distributed checkpoints.[8] A checkpoint is an automatic, asynchronous snapshot of the state of an application and the position in a source stream. In the case of a failure, a Flink program with checkpointing enabled will, upon recovery, resume processing from the last completed checkpoint, ensuring that Flink maintains exactly-once state semantics within an application. The checkpointing mechanism exposes hooks for application code to include external systems into the checkpointing mechanism as well (like opening and committing transactions with a database system).

Flink also includes a mechanism called savepoints, which are manually-triggered checkpoints.[20] A user can generate a savepoint, stop a running Flink program, then resume the program from the same application state and position in the stream. Savepoints enable updates to a Flink program or a Flink cluster without losing the application's state . As of Flink 1.2, savepoints also allow to restart an application with a different parallelism—allowing users to adapt to changing workloads.

DataStream API[edit]

Flink’s DataStream API enables transformations (e.g. filters, aggregations, window functions) on bounded or unbounded streams of data. The DataStream API includes more than 20 different types of transformations and is available in Java and Scala.[21]

A simple example of a stateful stream processing program is an application that emits a word count from a continuous input stream and groups the data in 5-second windows:

import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.time.Time

case class WordCount(word: String, count: Int)

object WindowWordCount {
  def main(args: Array[String]) {

    val env = StreamExecutionEnvironment.getExecutionEnvironment
    val text = env.socketTextStream("localhost", 9999)

    val counts = text.flatMap { _.toLowerCase.split("\\W+") filter { _.nonEmpty } }
      .map { WordCount(_, 1) }
      .keyBy("word")
      .timeWindow(Time.seconds(5))
      .sum("count")

    counts.print

    env.execute("Window Stream WordCount")
  }
}

Apache Beam - Flink Runner[edit]

Apache Beam “provides an advanced unified programming model, allowing (a developer) to implement batch and streaming data processing jobs that can run on any execution engine.”[22] The Apache Flink-on-Beam runner is the most feature-rich according to a capability matrix maintained by the Beam community.[23]

data Artisans, in conjunction with the Apache Flink community, worked closely with the Beam community to develop a robust Flink runner.[24]

DataSet API[edit]

Flink’s DataSet API enables transformations (e.g. filters, mapping, joining, grouping) on bounded datasets. The DataSet API includes more than 20 different types of transformations.[25] The API is available in Java, Scala and an experimental Python API. Flink’s DataSet API is conceptually similar to the DataStream API.

Table API and SQL[edit]

Flink's Table API is a SQL-like expression language for relational stream and batch processing that can be embedded in Flink’s Java and Scala DataSet and DataStream APIs. The Table API and SQL interface operate on a relational Table abstraction. Tables can be created from external data sources or from existing DataStreams and DataSets. The Table API supports relational operators such as selection, aggregation, and joins on Tables.

Tables can also be queried with regular SQL. The Table API and SQL offer equivalent functionality and can be mixed in the same program. When a Table is converted back into a DataSet or DataStream, the logical plan, which was defined by relational operators and SQL queries, is optimized using Apache Calcite and is transformed into a DataSet or DataStream program.

Flink Forward[edit]

Flink Forward is an annual conference about Apache Flink. The first edition of Flink Forward took place in 2015 in Berlin. The two-day conference had over 250 attendees from 16 countries. Sessions were organized in two tracks with over 30 technical presentations from Flink developers and one additional track with hands-on Flink training.

In 2016, 350 participants joined the conference and over 40 speakers presented technical talks in 3 parallel tracks. On the third day, attendees were invited to participate in hands-on training sessions.

In 2017, the event expands to San Francisco, as well. The conference day is dedicated to technical talks on how Flink is used in the enterprise, Flink system internals, ecosystem integrations with Flink, and the future of the platform. It features keynotes, talks from Flink users in industry and academia, and hands-on training sessions on Apache Flink.

Speakers from the following organizations have presented at Flink Forward conferences: Alibaba, Amadeus, Bouygues Telecom, Capital One, Cloudera, data Artisans, EMC, Ericsson, Hortonworks, Huawei, IBM, Google, MapR, MongoDB, Netflix, New Relic, Otto Group, Red Hat, ResearchGate, Uber, and Zalando.[26][27]

History[edit]

In 2010, the research project "Stratosphere: Information Management on the Cloud"[28] (funded by the German Research Foundation (DFG)[29]) was started as a collaboration of Technical University Berlin, Humboldt-Universität zu Berlin, and Hasso-Plattner-Institut Potsdam. Flink started from a fork of Stratosphere’s distributed execution engine and it became an Apache Incubator project in March 2014.[30] In December 2014, Flink was accepted as an Apache top-level project.[31][32][33][34]

Version Original release date Latest version Release date
Old version, no longer supported: 0.9 2015-06-24 0.9.1 2015-09-01
Old version, no longer supported: 0.10 2015-11-16 0.10.2 2016-02-11
Old version, no longer supported: 1.0 2016-03-08 1.0.3 2016-05-11
Old version, no longer supported: 1.1 2016-08-08 1.1.4 2016-12-21
Old version, no longer supported: 1.2 2017-02-06 1.2.1 2017-04-26
Old version, no longer supported: 1.3 2017-06-01 1.3.3 2018-03-15
Older version, yet still supported: 1.4 2017-12-12 1.4.2 2018-03-08
Current stable version: 1.5 2018-05-25 1.5.0 2018-05-25
Legend:
Old version
Older version, still supported
Latest version
Latest preview version
Future release

Release Dates

Apache Incubator Release Dates

Pre-Apache Stratosphere Release Dates

  • 01/2014: Stratosphere 0.4 (version 0.3 was skipped)
  • 08/2012: Stratosphere 0.2
  • 05/2011: Stratosphere 0.1 (08/2011: v0.1.1)

See also[edit]

References[edit]

  1. ^ "Apache Flink: Scalable Batch and Stream Data Processing". apache.org. 
  2. ^ "apache/flink". GitHub. 
  3. ^ Alexander Alexandrov, Rico Bergmann, Stephan Ewen, Johann-Christoph Freytag, Fabian Hueske, Arvid Heise, Odej Kao, Marcus Leich, Ulf Leser, Volker Markl, Felix Naumann, Mathias Peters, Astrid Rheinländer, Matthias J. Sax, Sebastian Schelter, Mareike Höger, Kostas Tzoumas, and Daniel Warneke. 2014. The Stratosphere platform for big data analytics. The VLDB Journal 23, 6 (December 2014), 939-964. DOI
  4. ^ Ian Pointer (7 May 2015). "Apache Flink: New Hadoop contender squares off against Spark". InfoWorld. 
  5. ^ "On Apache Flink. Interview with Volker Markl". odbms.org. 
  6. ^ Stephan Ewen, Kostas Tzoumas, Moritz Kaufmann, and Volker Markl. 2012. Spinning fast iterative data flows. Proc. VLDB Endow. 5, 11 (July 2012), 1268-1279. DOI
  7. ^ "Benchmarking Streaming Computation Engines at Yahoo!". Yahoo Engineering. Retrieved 2017-02-23. 
  8. ^ a b Carbone, Paris; Fóra, Gyula; Ewen, Stephan; Haridi, Seif; Tzoumas, Kostas (2015-06-29). "Lightweight Asynchronous Snapshots for Distributed Dataflows". arXiv:1506.08603Freely accessible [cs.DC]. 
  9. ^ "Apache Flink 1.2.0 Documentation: Flink DataStream API Programming Guide". ci.apache.org. Retrieved 2017-02-23. 
  10. ^ "Apache Flink 1.2.0 Documentation: Python Programming Guide". ci.apache.org. Retrieved 2017-02-23. 
  11. ^ "Apache Flink 1.2.0 Documentation: Table and SQL". ci.apache.org. Retrieved 2017-02-23. 
  12. ^ Fabian Hueske, Mathias Peters, Matthias J. Sax, Astrid Rheinländer, Rico Bergmann, Aljoscha Krettek, and Kostas Tzoumas. 2012. Opening the black boxes in data flow optimization. Proc. VLDB Endow. 5, 11 (July 2012), 1256-1267. DOI
  13. ^ Daniel Warneke and Odej Kao. 2009. Nephele: efficient parallel data processing in the cloud. In Proceedings of the 2nd Workshop on Many-Task Computing on Grids and Supercomputers (MTAGS '09). ACM, New York, NY, USA, Article 8, 10 pages. DOI
  14. ^ a b "Apache Flink 1.2.0 Documentation: Streaming Connectors". ci.apache.org. Retrieved 2017-02-23. 
  15. ^ "ASF Git Repos - flink.git/blob - LICENSE". apache.org. 
  16. ^ "Team – data Artisans". data-artisans.com. Retrieved 2017-02-23. 
  17. ^ "Apache Flink: Community & Project Info". flink.apache.org. Retrieved 2017-02-23. 
  18. ^ a b "Apache Flink 1.2.0 Documentation: Dataflow Programming Model". ci.apache.org. Retrieved 2017-02-23. 
  19. ^ "Apache Flink 1.2.0 Documentation: Distributed Runtime Environment". ci.apache.org. Retrieved 2017-02-24. 
  20. ^ "Apache Flink 1.2.0 Documentation: Distributed Runtime Environment - Savepoints". ci.apache.org. Retrieved 2017-02-24. 
  21. ^ "Apache Flink 1.2.0 Documentation: Flink DataStream API Programming Guide". ci.apache.org. Retrieved 2017-02-24. 
  22. ^ "Apache Beam". beam.apache.org. Retrieved 2017-02-24. 
  23. ^ "Apache Beam Capability Matrix". beam.apache.org. Retrieved 2017-02-24. 
  24. ^ "Why Apache Beam? A Google Perspective | Google Cloud Big Data and Machine Learning Blog | Google Cloud Platform". Google Cloud Platform. Retrieved 2017-02-24. 
  25. ^ "Apache Flink 1.2.0 Documentation: Flink DataSet API Programming Guide". ci.apache.org. Retrieved 2017-02-24. 
  26. ^ "Sessions | FlinkForward | 12-14 Sep 2016 | Berlin". 2016.flink-forward.org. Retrieved 2017-02-24. 
  27. ^ "Flink Forward » Flink Forward 2015". 2015.flink-forward.org. Retrieved 2017-02-24. 
  28. ^ "Stratosphere". stratosphere.eu. 
  29. ^ "DFG - Deutsche Forschungsgemeinschaft -". dfg.de. 
  30. ^ "Stratosphere". apache.org. 
  31. ^ "Project Details for Apache Flink". apache.org. 
  32. ^ "The Apache Software Foundation Announces Apache™ Flink™ as a Top-Level Project : The Apache Software Foundation Blog". apache.org. 
  33. ^ "Will the mysterious Apache Flink find a sweet spot in the enterprise?". siliconangle.com. 
  34. ^ (in German)
  35. ^ "Benchmarking Streaming Computation Engines: Storm, Flink and Spark Streaming" (PDF). IEEE. May 2016. 

External links[edit]