O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Stream Processing with Apache Flink

Book Description

With Early Release ebooks, you get books in their earliest form—the author's raw and unedited content as he or she writes—so you can take advantage of these technologies long before the official release of these titles. You’ll also receive updates when significant changes are made, new chapters are available, and the final ebook bundle is released.

Get started with Apache Flink, the open source framework that enables you to process streaming data—such as user interactions, sensor data, and machine logs—as it arrives. With this practical guide, you’ll learn how to use Apache Flink’s stream processing APIs to implement, continuously run, and maintain real-world applications.

Authors Fabian Hueske, one of Flink’s creators, and Vasia Kalavri, a core contributor to Flink’s graph processing API (Gelly), explains the fundamental concepts of parallel stream processing and shows you how streaming analytics differs from traditional batch data analysis. Software engineers, data engineers, and system administrators will learn the basics of Flink’s DataStream API, including the structure and components of a common Flink streaming application.

  • Solve real-world problems with Apache Flink’s DataStream API
  • Set up an environment for developing stream processing applications for Flink
  • Design streaming applications and migrate periodic batch workloads to continuous streaming workloads
  • Learn about windowed operations that process groups of records
  • Ingest data streams into a DataStream application and emit a result stream into different storage systems
  • Implement stateful and custom operators common in stream processing applications
  • Operate, maintain, and update continuously running Flink streaming applications
  • Explore several deployment options, including the setup of highly available installations

Table of Contents

  1. 1. Introduction to Stateful Stream Processing
    1. Traditional Data Infrastructures
    2. Stateful Stream Processing
      1. Event-driven Applications
      2. Data Pipelines and Real-time ETL
      3. Streaming Analytics
    3. The Evolution of Open Source Stream Processing
    4. A Taste of Flink
    5. What You Will Learn in This Book
  2. 2. Stream Processing Fundamentals
    1. Introduction to dataflow programming
      1. Dataflow graphs
      2. Data parallelism and task parallelism
      3. Data exchange strategies
    2. Processing infinite streams in parallel
      1. Latency and throughput
      2. Operations on data streams
    3. Time semantics
      1. What is the meaning of one minute?
      2. Processing time
      3. Event time
      4. Watermarks
      5. Processing time vs. event time
    4. State and consistency models
      1. Task failures
      2. Result guarantees
    5. Summary
  3. 3. The Architecture of Apache Flink
    1. System Architecture
      1. Components of a Flink Setup
      2. Application Deployment
      3. Task Execution
      4. Highly-Available Setup
    2. Data Transfer in Flink
      1. High Throughput and Low Latency
      2. Flow Control with Back Pressure
    3. Event Time Processing
      1. Timestamps
      2. Watermarks
      3. Watermarks and Event Time
      4. Timestamp Assignment and Watermark Generation
    4. State Management
      1. Operator State
      2. Keyed State
      3. State Backends
      4. Scaling Stateful Operators
    5. Checkpoints, Savepoints, and State Recovery
      1. Consistent Checkpoints
      2. Recovery from Consistent Checkpoints
      3. Flink’s Lightweight Checkpointing Algorithm
      4. Savepoints
    6. Summary
  4. 4. Setting up a development environment for Apache Flink
    1. Required Software
    2. Run and debug Flink applications in an IDE
      1. Import the book’s examples in your IDE
      2. Run Flink applications in an IDE
      3. Debug Flink applications in an IDE
    3. Bootstrap a Flink Maven project
  5. 5. The DataStream API (v1.4.0)
    1. Hello, Flink!
      1. Set up the execution environment
      2. Read an input stream
      3. Apply transformations
      4. Output the result
      5. Execute
    2. Types
      1. Supported Data Types
      2. Type Hints
      3. TypeInformation
    3. Transformations
      1. Basic transformations
      2. KeyedStream transformations
      3. Multi-stream transformations
      4. Partitioning transformations
    4. Setting the parallelism
    5. Referencing fields and defining keys
    6. Defining UDFs
    7. Summary
  6. 6. Time-based and Window Operators
    1. Configuring Time Characteristics
      1. Timestamps and watermarks for event-time applications
      2. Watermarks, Latency, and Completeness
    2. Process Functions
      1. The TimerService and Timers
      2. Emitting to Side Outputs
      3. The CoProcessFunction
    3. Window Operators
      1. Defining Window Operators
      2. Built-in Window Assigners
      3. Applying Functions on Windows
      4. Customizing Window Operators
    4. Joining Streams on Time
    5. Handling Late Data
      1. Dropping Late Events
      2. Redirecting Late Events
      3. Updating Results by Including Late Events
    6. Summary
  7. 7. Stateful Operators and User Functions
    1. Implementing Stateful Functions
      1. Declaring Keyed State at the RuntimeContext
      2. Implementing Operator List State with the ListCheckpointed Interface
      3. Using Connected Broadcast State
      4. Using the CheckpointedFunction Interface
    2. Robustness and Performance of Stateful Applications
      1. Choosing a State Backend
      2. Enabling Checkpointing
      3. Updating Stateful Operators
      4. Tuning the Performance of Stateful Applications
      5. Preventing Leaking State
    3. Queryable State
      1. Architecture and Enabling Queryable State
      2. Exposing Queryable State
      3. Querying State from External Applications
    4. Summary