SlideShare a Scribd company logo
OfferUp Confidential
Large-scale Near-real-time Stream Processing
with Apache Flink @ OfferUp
Bowen Li
User Survey
● Who has used OfferUp?
● Who has used Apache Flink?
● Who has developed code in Apache Flink?
OfferUp, create the simplest, most trustworthy way to buy and sell locally
At a Glance
● the largest mobile marketplace for local
buyers and sellers in the U.S.
● Top shopping app on iOS and Android
● $14+ Billion In Transactions in 2016
Speaker Background
Bowen Li
○ Offerup
■ Develop stream processing infra with Apache Flink
■ Apache Airflow, Apache Avro, etc
○ Tableau
■ Lots of Apache ZooKeeper and Apache Curator
Stream Processing @ OfferUp
We are expanding our stream processing footprint.
We developed OfferUp’s stream processing platform with a few primitives:
● Flink installation on EMR
● HDFS, YARN, metrics, checkpoint/savepoint, etc. configuration help for Flink cluster
● User apps deployment
● Connecting to streams
● Data Ser/Deser
Use Case
Business Requirement:
● Calculate time-decaying personalization scores based on user activity within
the last month
Use Case - The old pipeline
The old pipeline:
● batch processing
● ~3 hours of end-to-end latency
Use Case - The new near-real-time pipeline!
Pipeline Stats
● Data Volume: processing billions of records per day
● Average end-to-end latency: ~1 min
○ The 2min aggregation in 1st Flink cluster (NRT scores) dominates the latency
○ Depending on when the event enters the 2min window, the minimum latency of
this pipeline can be a few seconds, the expected maximum is ~2min
We dramatically lowered the end-to-end latency from ~3h to ~1min!
Design Considerations Explained
● Latency - why 2min aggregation
○ User-facing services will only batch-read new scores every 5min
○ Any latency smaller than 5min is good
Design Considerations Explained (con’t)
● Data Correctness
○ at-least-once guarantee
○ Be careful with merging NRT scores with historical scores, ensure no overlap and
no gap
Design Considerations Explained (con’t)
● Failure Recovery (assuming AWS Kinesis are reliable)
○ Two Flink clusters have checkpointing enabled and they can auto recover
○ Redis data has 3 day TTL, enough time to fix things up
○ Other parts are stateless
Design Considerations Explained (con’t)
● Replay Capability
○ Each component can handle data load of replay, and its latency is not greatly
impacted
Contribution to Apache Flink
I’ve been contributing to Apache Flink since Mar 2017
Related Contributions to Apache Flink
● FLINK-7508 Improved flink-connector-kinesis write performance by 10+X
○ Released version 1.3.2
○ Many other comprehensive improvements of flink-connector-kinesis
○ 13 out of my 43 commits
● FLINK-7475 Improved Flink’s ListState APIs() and boost its performance by 15~35X
○ Will be released in version 1.5.0
● FLINK-6013 Created flink-metrics-datadog module
● Other contributions include Flink’s DataStream APIs, side output, build system, etc
● Problem: flink-connector-kinesis used to create one http connection for each request
● Improvement: Switched it to a connection pool mode
● Result: Improved flink-connector-kinesis’s write performance by 10+X
Contribution: Improved flink-connector-kinesis
# Records Sent
# Records Pending in Client
In this basic test, you can tell
1) write throughput goes up
2) # pending records has dropped significantly
Benchmarking:
● Running a Flink hourly-sliding windowing job
● Enough Kinesis shards
● ~70 bytes/record
Limitations: My Flink job is not developed for benchmarking. It only generates 21million records at maximum, which gives us
a 10X or more improvement estimate. In reality, the perf improvement should be more than 10X. You’re welcome to do your
own benchmarking
Contribution: Improved flink-connector-kinesis
Contribution: Improved Flink’s ListState performance 20~35X
Background on RocksDBStateBackend
Problems:
● ListState has only two APIs - add() and get()
● RocksDBListState translate add() as RocksDB.merge()
○ adding 100 elements takes 100 memtable write, very slow….
Improvements:
● Developed two new APIs in Flink 1.5 - update() and addAll()
● update() and addAll() will both simulate RocksDB’s byte merge operation, pre-merge all elements
upfront and write to memtable only once
Benchmarking added to source code: org.apache.flink.contrib.streaming.state.benchmark.RocksDBListStatePerformanceTest
Result: 15 ~35X faster!
Q&A
Thank you!
We’re hiring!

More Related Content

PDF
Apache Flink @ Alibaba - Seattle Apache Flink Meetup
PDF
Uber Real Time Data Analytics
PPTX
Robust Stream Processing With Apache Flink
PDF
uReplicator: Uber Engineering’s Scalable, Robust Kafka Replicator
PDF
Flink Forward San Francisco 2019: Apache Beam portability in the times of rea...
PDF
Apache Beam @ GCPUG.TW Flink.TW 20161006
PDF
Hadoop summit - Scaling Uber’s Real-Time Infra for Trillion Events per Day
PPTX
Robust Stream Processing with Apache Flink
Apache Flink @ Alibaba - Seattle Apache Flink Meetup
Uber Real Time Data Analytics
Robust Stream Processing With Apache Flink
uReplicator: Uber Engineering’s Scalable, Robust Kafka Replicator
Flink Forward San Francisco 2019: Apache Beam portability in the times of rea...
Apache Beam @ GCPUG.TW Flink.TW 20161006
Hadoop summit - Scaling Uber’s Real-Time Infra for Trillion Events per Day
Robust Stream Processing with Apache Flink

What's hot (20)

PPTX
Counting Elements in Streams
PPTX
Kafka Summit NYC 2017 - Data Processing at LinkedIn with Apache Kafka
PDF
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
PDF
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
PDF
Gwen Shapira, Confluent | Kafka Summit 2020 Keynote | Kafka’s New Architecture
PDF
Kafka Summit NYC 2017 - Building Advanced Streaming Applications using the La...
PPTX
RedisConf17 - Pain-free Pipelining
PDF
Securing the Message Bus with Kafka Streams | Paul Otto and Ryan Salcido, Raf...
PDF
Flink Forward San Francisco 2018: Gregory Fee - "Bootstrapping State In Apach...
PDF
Flink Forward San Francisco 2019: Elastic Data Processing with Apache Flink a...
PPTX
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
PDF
Flink Forward Berlin 2017: Steffen Hausmann - Build a Real-time Stream Proces...
PDF
Administrative techniques to reduce Kafka costs | Anna Kepler, Viasat
PDF
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
PDF
Putting Kafka Together with the Best of Google Cloud Platform
PPTX
Kafka Practices @ Uber - Seattle Apache Kafka meetup
PDF
Tensorflow data preparation on Apache Beam using Portable Flink Runner, Ankur...
PDF
Deploying Confluent Platform for Production
PDF
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
PPTX
Portable Streaming Pipelines with Apache Beam
Counting Elements in Streams
Kafka Summit NYC 2017 - Data Processing at LinkedIn with Apache Kafka
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Kafka Summit NYC 2017 - Scalable Real-Time Complex Event Processing @ Uber
Gwen Shapira, Confluent | Kafka Summit 2020 Keynote | Kafka’s New Architecture
Kafka Summit NYC 2017 - Building Advanced Streaming Applications using the La...
RedisConf17 - Pain-free Pipelining
Securing the Message Bus with Kafka Streams | Paul Otto and Ryan Salcido, Raf...
Flink Forward San Francisco 2018: Gregory Fee - "Bootstrapping State In Apach...
Flink Forward San Francisco 2019: Elastic Data Processing with Apache Flink a...
Better Kafka Performance Without Changing Any Code | Simon Ritter, Azul
Flink Forward Berlin 2017: Steffen Hausmann - Build a Real-time Stream Proces...
Administrative techniques to reduce Kafka costs | Anna Kepler, Viasat
Tradeoffs in Distributed Systems Design: Is Kafka The Best? (Ben Stopford and...
Putting Kafka Together with the Best of Google Cloud Platform
Kafka Practices @ Uber - Seattle Apache Kafka meetup
Tensorflow data preparation on Apache Beam using Portable Flink Runner, Ankur...
Deploying Confluent Platform for Production
Analyzing Petabyte Scale Financial Data with Apache Pinot and Apache Kafka | ...
Portable Streaming Pipelines with Apache Beam
Ad

Similar to Stream processing with Apache Flink @ OfferUp (20)

PDF
2018-01 Seattle Apache Flink Meetup at OfferUp, Opening Remarks and Talk 2
PDF
Apache Flink - a Gentle Start
PDF
A look at Flink 1.2
PDF
Stefan Richter - A look at Flink 1.2 and beyond @ Berlin Meetup
PDF
Why Serverless Flink Matters - Blazing Fast Stream Processing Made Scalable
PDF
Flink Apachecon Presentation
PPTX
Stephan Ewen - Experiences running Flink at Very Large Scale
PPTX
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
PPTX
Kostas Tzoumas - Apache Flink®: State of the Union and What's Next
PDF
Unified Stream and Batch Processing with Apache Flink
PPTX
January 2016 Flink Community Update & Roadmap 2016
PPTX
Apache Flink - Overview and Use cases of a Distributed Dataflow System (at pr...
PDF
Flink Forward San Francisco 2019: High cardinality data stream processing wit...
PPTX
Apache Flink Berlin Meetup May 2016
PDF
Bay Area Apache Flink Meetup Community Update August 2015
PDF
Apache Flink
PPTX
Flink Meetup Septmeber 2017 2018
PPTX
Enhancing AI-Driven User Engagement with Real-Time Data Streaming via Flink.pptx
PPTX
Flink September 2015 Community Update
PPTX
Apache Flink(tm) - A Next-Generation Stream Processor
2018-01 Seattle Apache Flink Meetup at OfferUp, Opening Remarks and Talk 2
Apache Flink - a Gentle Start
A look at Flink 1.2
Stefan Richter - A look at Flink 1.2 and beyond @ Berlin Meetup
Why Serverless Flink Matters - Blazing Fast Stream Processing Made Scalable
Flink Apachecon Presentation
Stephan Ewen - Experiences running Flink at Very Large Scale
Flink Forward Berlin 2017: Till Rohrmann - From Apache Flink 1.3 to 1.4
Kostas Tzoumas - Apache Flink®: State of the Union and What's Next
Unified Stream and Batch Processing with Apache Flink
January 2016 Flink Community Update & Roadmap 2016
Apache Flink - Overview and Use cases of a Distributed Dataflow System (at pr...
Flink Forward San Francisco 2019: High cardinality data stream processing wit...
Apache Flink Berlin Meetup May 2016
Bay Area Apache Flink Meetup Community Update August 2015
Apache Flink
Flink Meetup Septmeber 2017 2018
Enhancing AI-Driven User Engagement with Real-Time Data Streaming via Flink.pptx
Flink September 2015 Community Update
Apache Flink(tm) - A Next-Generation Stream Processor
Ad

More from Bowen Li (13)

PDF
Flink and Hive integration - unifying enterprise data processing systems
PDF
Apache Flink 101 - the rise of stream processing and beyond
PDF
Towards Apache Flink 2.0 - Unified Data Processing and Beyond, Bowen Li
PDF
How to contribute to Apache Flink @ Seattle Flink meetup
PDF
Community update on flink 1.9 and How to Contribute to Flink
PDF
Integrating Flink with Hive - Flink Forward SF 2019
PDF
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
PDF
Community and Meetup Update, Seattle Flink Meetup, Feb 2019
PDF
Integrating Flink with Hive, Seattle Flink Meetup, Feb 2019
PDF
Status Update of Seattle Flink Meetup, Jun 2018
PDF
Streaming at Lyft, Gregory Fee, Seattle Flink Meetup, Jun 2018
PDF
Approximate queries and graph streams on Flink, theodore vasiloudis, seattle...
PDF
Opening - Seattle Apache Flink Meetup
Flink and Hive integration - unifying enterprise data processing systems
Apache Flink 101 - the rise of stream processing and beyond
Towards Apache Flink 2.0 - Unified Data Processing and Beyond, Bowen Li
How to contribute to Apache Flink @ Seattle Flink meetup
Community update on flink 1.9 and How to Contribute to Flink
Integrating Flink with Hive - Flink Forward SF 2019
AthenaX - Unified Stream & Batch Processing using SQL at Uber, Zhenqiu Huang,...
Community and Meetup Update, Seattle Flink Meetup, Feb 2019
Integrating Flink with Hive, Seattle Flink Meetup, Feb 2019
Status Update of Seattle Flink Meetup, Jun 2018
Streaming at Lyft, Gregory Fee, Seattle Flink Meetup, Jun 2018
Approximate queries and graph streams on Flink, theodore vasiloudis, seattle...
Opening - Seattle Apache Flink Meetup

Recently uploaded (20)

PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Strings in CPP - Strings in C++ are sequences of characters used to store and...
PPTX
Geodesy 1.pptx...............................................
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
web development for engineering and engineering
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
DOCX
573137875-Attendance-Management-System-original
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Sustainable Sites - Green Building Construction
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Construction Project Organization Group 2.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Lecture Notes Electrical Wiring System Components
Strings in CPP - Strings in C++ are sequences of characters used to store and...
Geodesy 1.pptx...............................................
Internet of Things (IOT) - A guide to understanding
web development for engineering and engineering
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
573137875-Attendance-Management-System-original
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Operating System & Kernel Study Guide-1 - converted.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Digital Logic Computer Design lecture notes
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Sustainable Sites - Green Building Construction
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
OOP with Java - Java Introduction (Basics)
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Construction Project Organization Group 2.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT

Stream processing with Apache Flink @ OfferUp

  • 1. OfferUp Confidential Large-scale Near-real-time Stream Processing with Apache Flink @ OfferUp Bowen Li
  • 2. User Survey ● Who has used OfferUp? ● Who has used Apache Flink? ● Who has developed code in Apache Flink?
  • 3. OfferUp, create the simplest, most trustworthy way to buy and sell locally At a Glance ● the largest mobile marketplace for local buyers and sellers in the U.S. ● Top shopping app on iOS and Android ● $14+ Billion In Transactions in 2016
  • 4. Speaker Background Bowen Li ○ Offerup ■ Develop stream processing infra with Apache Flink ■ Apache Airflow, Apache Avro, etc ○ Tableau ■ Lots of Apache ZooKeeper and Apache Curator
  • 5. Stream Processing @ OfferUp We are expanding our stream processing footprint. We developed OfferUp’s stream processing platform with a few primitives: ● Flink installation on EMR ● HDFS, YARN, metrics, checkpoint/savepoint, etc. configuration help for Flink cluster ● User apps deployment ● Connecting to streams ● Data Ser/Deser
  • 6. Use Case Business Requirement: ● Calculate time-decaying personalization scores based on user activity within the last month
  • 7. Use Case - The old pipeline The old pipeline: ● batch processing ● ~3 hours of end-to-end latency
  • 8. Use Case - The new near-real-time pipeline!
  • 9. Pipeline Stats ● Data Volume: processing billions of records per day ● Average end-to-end latency: ~1 min ○ The 2min aggregation in 1st Flink cluster (NRT scores) dominates the latency ○ Depending on when the event enters the 2min window, the minimum latency of this pipeline can be a few seconds, the expected maximum is ~2min We dramatically lowered the end-to-end latency from ~3h to ~1min!
  • 10. Design Considerations Explained ● Latency - why 2min aggregation ○ User-facing services will only batch-read new scores every 5min ○ Any latency smaller than 5min is good
  • 11. Design Considerations Explained (con’t) ● Data Correctness ○ at-least-once guarantee ○ Be careful with merging NRT scores with historical scores, ensure no overlap and no gap
  • 12. Design Considerations Explained (con’t) ● Failure Recovery (assuming AWS Kinesis are reliable) ○ Two Flink clusters have checkpointing enabled and they can auto recover ○ Redis data has 3 day TTL, enough time to fix things up ○ Other parts are stateless
  • 13. Design Considerations Explained (con’t) ● Replay Capability ○ Each component can handle data load of replay, and its latency is not greatly impacted
  • 14. Contribution to Apache Flink I’ve been contributing to Apache Flink since Mar 2017
  • 15. Related Contributions to Apache Flink ● FLINK-7508 Improved flink-connector-kinesis write performance by 10+X ○ Released version 1.3.2 ○ Many other comprehensive improvements of flink-connector-kinesis ○ 13 out of my 43 commits ● FLINK-7475 Improved Flink’s ListState APIs() and boost its performance by 15~35X ○ Will be released in version 1.5.0 ● FLINK-6013 Created flink-metrics-datadog module ● Other contributions include Flink’s DataStream APIs, side output, build system, etc
  • 16. ● Problem: flink-connector-kinesis used to create one http connection for each request ● Improvement: Switched it to a connection pool mode ● Result: Improved flink-connector-kinesis’s write performance by 10+X Contribution: Improved flink-connector-kinesis # Records Sent # Records Pending in Client In this basic test, you can tell 1) write throughput goes up 2) # pending records has dropped significantly
  • 17. Benchmarking: ● Running a Flink hourly-sliding windowing job ● Enough Kinesis shards ● ~70 bytes/record Limitations: My Flink job is not developed for benchmarking. It only generates 21million records at maximum, which gives us a 10X or more improvement estimate. In reality, the perf improvement should be more than 10X. You’re welcome to do your own benchmarking Contribution: Improved flink-connector-kinesis
  • 18. Contribution: Improved Flink’s ListState performance 20~35X Background on RocksDBStateBackend Problems: ● ListState has only two APIs - add() and get() ● RocksDBListState translate add() as RocksDB.merge() ○ adding 100 elements takes 100 memtable write, very slow…. Improvements: ● Developed two new APIs in Flink 1.5 - update() and addAll() ● update() and addAll() will both simulate RocksDB’s byte merge operation, pre-merge all elements upfront and write to memtable only once
  • 19. Benchmarking added to source code: org.apache.flink.contrib.streaming.state.benchmark.RocksDBListStatePerformanceTest Result: 15 ~35X faster!