Challenges and Experiences in Building an Efficient Apache Beam

Challenges and Experiences in Building an Efficient Apache Beam

Challenges and Experiences in Building an Efficient Apache Beam Runner For IBM Streams Shen Li† Paul Gerver* John MacMillan* Daniel Debrunner* William Marshall* Kun-Lung Wu† {shenli, pgerver}@us.ibm.com, [email protected], {debrunne, wcmarsha, klwu}@us.ibm.com †IBM Research AI *IBM Watson Cloud Platform ABSTRACT 1. INTRODUCTION This paper describes the challenges and experiences in the Distributed stream computing has been adopted by a rap- development of IBM Streams runner for Apache Beam. Apa- idly increasing number of industrial applications. For exam- che Beam is emerging as a common stream programming in- ple, social networks use streaming analytic systems to de- terface for multiple computing engines. Each participating tect trending topics and react to news events. Peer-to-peer engine implements a runner to translate Beam applications ridesharing and food delivery companies process streaming into engine-specific programs. Hence, applications written spatial-temporal data to timely pair supply and demand. with the Beam SDK can be executed on different under- Online advertisement platforms continuously optimize con- lying stream computing engines, with negligible migration tent placement to maximize monetary gains. Digital health- penalty. IBM Streams is a widely-used enterprise streaming care providers collect and evaluate wearable device sensory platform. It has a rich set of connectors and toolkits for easy data to offer lifestyle suggestions and launch critical alarms. integration of streaming applications with other enterprise Data centers monitor hardware and software status around applications. It also supports a broad range of programming the clock to capture performance anomalies. Numerous ap- language interfaces, including Java, C++, Python, Stream plications seek the ability to quickly react to dynamic stream- Processing Language (SPL) and Apache Beam. This pa- ing data, as it is either a mandatory requirement or a com- per focuses on our solutions to efficiently support the Beam petitive advantage. programming abstractions in IBM Streams runner. Beam These demands catalyze the developments of various types organizes data into discrete event time windows. This de- of stream computing engines, including Apex [2], AthenaX sign, on the one hand, supports out-of-order data arrivals, [10], Google Dataflow [20, 11], Flink [5, 22], Gearpump [6], but on the other hand, forces runners to maintain more Heron [18, 24], Samza [8, 31], Spark Streaming [37, 38], IBM states, which leads to higher space and computation over- Streams [12, 35, 28, 34, 33, 32, 26], etc. However, from the head. IBM Streams runner mitigates this problem by ef- perspective of application developers, the decision is not al- ficiently indexing inter-dependent states, garbage-collecting ways straightforward when exposed to abundant underlying stale keys, and enforcing bundle sizes. We also share per- engine options. Each stream computing engine designs their formance concerns in Beam that could potentially impact own programming API which means they are not compati- applications. Evaluations show that IBM Streams runner ble with each other. outperforms Flink runner and Spark runner in most scenar- Recently, the emerging Apache Beam [3] project aims to ios when running the Beam NEXMark benchmarks. IBM provide a common programming interface. The Beam SDK Streams runner is available for download from IBM Cloud inherits from Google Cloud Dataflow API [20]. It is a uni- Streaming Analytics service console. fied model for both batch and streaming processing. Ap- plication pipelines written using the Beam API can run on PVLDB Reference Format: different underlying engines without modifying their appli- Shen Li, Paul Gerver, John MacMillan, Daniel Debrunner, William cations, which significantly reduces the switching overhead. Marshall, Kun-Lung Wu. Challenges and Experiences in Building Beam requires each participating engine to provide a run- an Efficient Apache Beam Runner For IBM Streams. PVLDB, 11 (12): 1742-1754, 2018. ner that is responsible for converting Beam applications into DOI: https://doi.org/10.14778/3229863.3229864 their engine native programs and submitting the programs for execution. The Beam SDK focuses on application logic and relies on runners and engines to figure out low-level sys- tem details, such as parallelism, graph fusion, consistency, durability, and failure recovery. This work is licensed under the Creative Commons Attribution- NonCommercial-NoDerivatives 4.0 International License. To view a copy This paper shares our experiences of building IBM Streams of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. For runner for Apache Beam. IBM Streams is a widely-used any use beyond those covered by this license, obtain permission by emailing stream computing platform for high-throughput and low- [email protected]. latency applications. It has a rich set of more than 80 con- Proceedings of the VLDB Endowment, Vol. 11, No. 12 nectors and toolkits, many of them open-sourced [14, 12], Copyright 2018 VLDB Endowment 2150-8097/18/8. allowing a developer to easily integrate their streaming ap- DOI: https://doi.org/10.14778/3229863.3229864 1742 plications with many other enterprise applications and ser- The remainder of the paper is organized as follows. Sec- vices. It supports a broad range of programming language tion 2 briefly illustrates the background for Apache Beam interfaces, including Java, C++, Python, Stream Processing and IBM Streams. Section 3 elaborates upon optimizations Language (SPL) [27] and so on. As Beam gains increasing in Streams runner. Implementation details are described in attention, supporting the Beam SDK further broadens the Section 4. Section 5 shares evaluation results, and further programming interfaces of IBM Streams, allowing stream discussions and suggestions are presented in Section 6. Sec- applications written in Beam to take advantages of the en- tion 7 summarizes related work. Finally, Section 8 concludes terprise strength of IBM Streams and its rich set of connec- the paper. tors and toolkits. Streams runner traverses a Beam pipeline and creates a 2. BACKGROUND directed acyclic graph (DAG) that conveys the same appli- This section briefly introduces the Apache Beam model cation logic using the Java API of the open-source Streams and IBM Streams runner design. Topology toolkit [14]. Then, the DAG can be automatically submitted to the IBM Streams Runtime or an IBM Cloud 2.1 Apache Beam Streaming Analytics service [12]. The Streams runtime has Apache Beam is a unified model for both streaming and already been optimized in the past decade in many aspects batch data processing, which has attracted increasing at- including elasticity [34], windowing efficiency [35], consis- tention from both academia and industry. Applications use tency [28], and load balancing [33]. Hence, IBM Streams the Beam SDK to build a pipeline (DAG) that consists of runner mainly focuses on improving the efficiency of indi- PCollections and PTransforms. A PCollection can be ei- vidual Beam operators. ther a bounded dataset or an unbounded data stream. A The challenges of designing the runner lie in how to handle PTransform takes one or multiple PCollections as inputs, ap- Beam windows and states. One challenge occurs in multi- plies user-defined functions, and produces new PCollections. input multi-output Beam operators whose states from in- The Beam SDK provides a rich set of composite PTransforms put streams are interdependent. Elements from one input based on six types of primitive PTransforms as described be- stream can refer to past or even future states of other input low. streams. When the requested states are not yet available, the operator needs to hold the element and instantly retrieve • Source creates a new PCollection from a data struc- it once the state becomes ready. Efficiently indexing pend- ture or an IO connector. ing states and elements are not trivial when applications use large fan-in operators with excessively long lookahead dis- • Window uses user-defined WindowFn to assign windows tances. To address this problem, Streams runner maintains to elements. a specialized DAG structure, which is called Pending States Graph, to index interdependent windows. Another chal- • ParDo takes one main input PCollection and multiple lenge emerges when serving an evolving set of keys. The side input PCollections. It applies a user-defined DoFn runner has to promptly detect and delete obsolete keys to to every element from the main input PCollection, prevent hitting an out-of-memory error. To track evolving and produces zero or more output PCollections. The contents with minimum overhead, Streams runner dissects DoFn can access windowed states (View) from side input keyed states into smaller components, and organizes them PCollections. into multiple interleaving ordered lists, which helps to delete • View converts every window of a PCollection into a obsolete states with low computational complexity. These data structure (e.g., List, Map, Set, Singleton, etc.) two techniques collectively boost the throughput of our run- using an application-specified function. These data ner by more than 100 fold when running query 4 and 5 from structures are later consumed as side inputs by ParDo Beam’s NEXMark benchmark [15]. PTransforms. Evaluations are conducted using NEXMark, and we de- veloped a microbenchmark to attain a more in-depth and • GroupByKey groups values with the same key in the comprehensive view of different runners. Results show

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us