(1) Monal Daxini presented on Netflix's use of Apache Flink for stream processing.
(2) Netflix introduced Flink two years ago and has driven its adoption within the company.
(3) Key aspects of Netflix's Flink usage include around 2,000 routing jobs processing around 3 trillion events per day across around 10,000 containers.
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Flink at netflix paypal speaker series
1. Stream Processing with Flink at Netflix
Monal Daxini
Stream Processing Lead
7/5/2018
@monaldax
2. • Worked on stream processing platform for business analytics for 4 years
• Including vision roadmap, and implementation
• Introduced Flink to Netflix 2 years ago, and drove adoption
Profile
3. @monaldax
Point & Click
Keystone Pipeline
Routing, Filtering, Projection
At-least-once
Streaming Jobs
Analytics, Applications,
Platforms
How do we leverage Flink?
Current Using Flink 1.4
Streaming SQL
(Future)
32. @monaldax
Router Flink Job In HA Mode With 1 Job Manager
Isolation - 1 Flink Clusters Runs One Routing Job
Zookeeper
Job Manager
Leader (WebUI)
Task Manager Task Manager Task Manager
One dedicated Zookeeper
cluster for all streamig Jobs
33. @monaldax
Flink Job Cluster In HA Mode With 2 Job Managers
Zookeeper
Job Manager
Leader (WebUI)
Task Manager Task Manager Task Manager
Job Manager
(WebUI)
One dedicated Zookeeper
cluster for all streamig Jobs
36. Broadly, Two Categories Of Streaming Jobs
• Stateless
• No state maintained across events (except Kafka offsets)
• Stateful
• State maintained across events
@monaldax
37. Image adapted from: Stephan Ewen
Stateless Stream Processor – No Internal State
@monaldax
40. @monaldax
Stateless Streaming Job Use Case: High Level Architecture
Enriching And Identifying Certain Plays
Playback
History Service
Video
Metadata
Streaming Job
Play Logs
Live Service Lookup Data
42. Search Sessionization – Custom Windowing On Out-of-order Events
...... S ES
……….Session 2: S
Hours
S E
Session 1:
SE …
@monaldax
43. Streaming Application
Flink Engine
Local State
Stateful Streaming Application With Local State, Checkpoints, And
Savepoints
Sinks
Savepoints
(Explicitly Triggered)
Ext. Checkpoints
(Automatic)
Sources
@monaldax
44. Checkpoint Ack With Metadata
Job
Manager
ACK
(metadata)
S3
State
Snapshot
barriers
47. State
● State sharding - Key Groups
○ Cannot change once set for a job
○ Total scale up limited by # of Key Groups
○ Lightweight - can have 1000s of Key Groups
● Scale up only from a savepoint, not from a checkpoint
51. ● Easy to use Data-flow programming model (VLDB, 2015)
○ Tools for reasoning about time - Event-time, watermarks, etc.
● Support for all messaging semantics including Exactly-once
● Exactly-once (semantics) fault tolerant state management (large state)
○ Enables Kappa Architecture
● Multiple connectors - sources and sinks
Why Flink?
52. ● Multi stage jobs with exactly once processing semantics
○ Without the need for an external queue
○ Parallelism can be set independently for each operator in the DAG
● Backpressure support
● Support for Scala & Java
● Open source and active Community
Why Flink?
54. Scaling S3 Based Flink Checkpoint Store
● S3 automatically shards buckets internally with steady growth in RPS
● Lack of entropy in prefix path hinders scalability
@monaldax
57. Reducing Snapshots Uploaded To S3
For stateless, or jobs with very small state
● Avoid S3 writes from Task Manager, aggregate state in Job Manager
state.backend.fs.memory-threshold = 1048576
58. Checkpoint Metadata File After All Acks
Job
Manager
Amazon
S3
2. Checkpoint
Data & Metadata
1. Snapshot
data & ACK
@monaldax
59. High Frequency Checkpoints
● For checkpointing interval < 5sec, and large flink clusters,
consider a different store than S3.
60. Too Many HEAD Requests, Despite Zero S3 Writes
• Create CheckpointStreamFactory only once during operator initialization
(FLINK-5800)
• Fixed since 1.3
67. Current implementation issue (FLINK-8042)
● Revert to full restart immediately if replacement container didn’t come
back in time (FLINK-8042)
● Issue will be addressed in FLIP-6
70. Challenges Of Stateful Job With Large State
1. Cannot avoid S3 writes from task managers
a. Each task manager has large state
2. Fine grained recovery (+1 standby) does not help
a. Connected job graph
3. Long recovery times
71. Stateful Jobs Often Have Data Shuffle Operation
A1
A2
A3
B1
B2
B3
C1
C2
C3
keyBysource window sink
S3
HDD
HDD
HDD
80. Flink Job Requires Reprocessing
Option 1: Rewind To A Checkpoint In The Past With Kafka Source
Time
Checkpoint y Checkpoint x
outage period
Checkpoint x+1
Now
81. Option 1: Rewind To A Checkpoint In The Past With Kafka
Source
Time
Checkpoint y Checkpoint x
outage period
Checkpoint x+1
Now
82. Option 2: Reprocess From Backfill source In Parallel
TimeNow ->outage period
83. Stateless Job - Works! Stateful Job Challenge - Partial
Ordered But Bounded Source and State Warm-up
Timeoutage periodWarm-up period
Emit outputNo output
Partial-Ordered
84. Complex Case of Reprocessing Events
What Should Job 2 do?
Time
outage period
1pm 4pm
85. For Reprocessing, We Are Leaning Towards Option 1
● Messaging system with Tiered Storage
○ Kafka holds recent data (past 24 hours), the rest flows to a
secondary storage like S3. Producers and Consumers would
be able to use this seamlessly, OR
○ Use another product that fulfils this need.
86. Not a lambda architecture
● Single streaming code base
● Just switch source from Kafka to Hive
87. Misc
• Hive Side Input for small reference tables
• Structured Data Infrastructure (In Progress…)
• Schema registration, validation and discovery infrastructure
• Notifications of end-to-end breaking schema changesProviding
• Schematized Keystone Pipeline Streams
• Managed State for Materialized shuffle between two jobs
89. Road Ahead
• Reprocess Data - Rewind or Backfill
• Schema support
• Few out of the box watermark Heuristics
• Low SPaaS user impact Infrastructure upgrades
• Auto scaling
• Easy resource provisioning estimates
• More Reusable blocks like Data hygiene
• Rate Limiter for External Service Calls