SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Real Time Investment Alerts @ ING
using Apache Kafka & Spring Kafka
Marcos Maia & Tim van Baarsen
SPRING.IO BARCELONA – MAY 2019
Introduction
Tim van Baarsen
Software Engineer at ING
@TimvanBaarsen
Marcos Maia
Software Engineer at ING
@thegroo
ING is active in more than 40 counties
3
https://www.ing.jobs
Agenda
4
• Use case @ ING
• Mifid II
• Mobile Investments App
• Overall Architecture
• Demo
• Metrics / Monitoring
• Kafka streams
• Local development / Code walk through
• Lessons learned
• Questions
Disclaimer
5
Both the code and high level architecture we show here today is
not the actual product we developed within ING!
This example is inspired by our work
Domain Lingo
6
Tick Price update on stock=
Mifid II: “Inform customers when a stock drops -10% in price
at the end of the day!”
7
Mifid II
Regulations
!
At the end of the day?
"No, in real time!Markets in Financial Instruments Directive II =
Regulatory reform financial markets European Union
came into effect on January 3, 2018
Screens of our mobile Investments app
8
price going up!
specific price
-10% drop
in price
Recurring alerts
2.000 – 12.000 stock updates a second!
9
! "
The perfect “match”
10
❤
Overall architecture
11
Alert service
A
P
I
Matching
Service
Stocks
update
receiver
Internet
“SMS
Platform”
A
P
I
Receive stock price
updates ~
12.000/sec
Publish stock price
updates to Kafka
Create alerts
Delete alerts
List alerts Customer
receives
investment
alert
Consume updates
& match against
alerts created by
customers
In case of a match
send a sms to
customer
Customer alert(s)
stored in database
Notification
Service
Schema
Registry
Zookeeper
“Push
Platform”
A
P
I
!
Quick Demo
12
Monitoring - Metrics
13
• Micrometer
• Think SLF4J, but for metrics (Jon Schneider)
• Application metrics
• Out of the box metrics
• Business metrics
• Vendor Neutral
Monitoring – Real-time?
14
Kafka Streams Join
15
Matching
Service
raw-stock-quote stock-quote-tick stock-quote-meta
log-compaction
Raw-tick
stock-quote-ticker RocksDB
Key value
ING Raw-tick
GOOGL Raw-tick
AAPL Raw-tick
Key value
ING Meta-data
GOOGL Meta-data
AAPL Meta-data
GlobalKTableKStream
Local development
16
• Docker
• Kafka
• Zookeeper
• Kafka manager
• All our Spring Boot applications
• Producers for development
• Custom Kafka command line producer
• Lab project
Spring Kafka
17
• Producing:
• ProducerFactory
• KafkaTemplate
• “The producer is thread safe and sharing a single producer instance
across threads will generally be faster
than having multiple instances.”
• Consuming
• Kafka consumers are not thread safe
• @KafkaListener
• MessageListener (many different interfaces)
• Access to ConsumerRecord
• Access to manual control to commit the offset
• Scale up multiple consumer (threads) within the application
Spring Kafka
18
• Integration tests
• Junit rule: EmbeddedKafkaRule
• @EmbeddedKafka
• Metrics
• Kafka consumer metrics out of the box (Micrometer)
Lessons learned
19
• Use Spring Kafka after you understand the Kafka APIs
• Error handling
• (De)serialization -> Apache Avro
• Think about # of partitions per topic upfront if possible (routing)
• Can your consumers keep up? Can you scale up?
• Monitor your topics / streams in production
• Based on metrics -> Micrometer
Lessons learned
20
• Kafka clients are backward compatible with Kafka brokers
• Kafka Streams
• KTables
• GlobalKTables
• Interactive Queries
• RocksDB build for ssd
• Describe
• processing.guarantee=exactly_once
• Kafka topology
• Plan ahead
• small & multiple topologies
Questions
21
!
Contact
Tim van Baarsen
Software Engineer @ ING
@TimvanBaarsen
Marcos Maia
Software Engineer @ ING
@thegroo
Spring.io Barcelona May 2019 - Real Time Investment Alerts @ ING using Apache Kafka & Spring Kafka

Contenu connexe

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Dernier (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

En vedette

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn
 

En vedette (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Spring.io Barcelona May 2019 - Real Time Investment Alerts @ ING using Apache Kafka & Spring Kafka

  • 1. Real Time Investment Alerts @ ING using Apache Kafka & Spring Kafka Marcos Maia & Tim van Baarsen SPRING.IO BARCELONA – MAY 2019
  • 2. Introduction Tim van Baarsen Software Engineer at ING @TimvanBaarsen Marcos Maia Software Engineer at ING @thegroo
  • 3. ING is active in more than 40 counties 3 https://www.ing.jobs
  • 4. Agenda 4 • Use case @ ING • Mifid II • Mobile Investments App • Overall Architecture • Demo • Metrics / Monitoring • Kafka streams • Local development / Code walk through • Lessons learned • Questions
  • 5. Disclaimer 5 Both the code and high level architecture we show here today is not the actual product we developed within ING! This example is inspired by our work
  • 6. Domain Lingo 6 Tick Price update on stock=
  • 7. Mifid II: “Inform customers when a stock drops -10% in price at the end of the day!” 7 Mifid II Regulations ! At the end of the day? "No, in real time!Markets in Financial Instruments Directive II = Regulatory reform financial markets European Union came into effect on January 3, 2018
  • 8. Screens of our mobile Investments app 8 price going up! specific price -10% drop in price Recurring alerts
  • 9. 2.000 – 12.000 stock updates a second! 9 ! "
  • 11. Overall architecture 11 Alert service A P I Matching Service Stocks update receiver Internet “SMS Platform” A P I Receive stock price updates ~ 12.000/sec Publish stock price updates to Kafka Create alerts Delete alerts List alerts Customer receives investment alert Consume updates & match against alerts created by customers In case of a match send a sms to customer Customer alert(s) stored in database Notification Service Schema Registry Zookeeper “Push Platform” A P I !
  • 13. Monitoring - Metrics 13 • Micrometer • Think SLF4J, but for metrics (Jon Schneider) • Application metrics • Out of the box metrics • Business metrics • Vendor Neutral
  • 15. Kafka Streams Join 15 Matching Service raw-stock-quote stock-quote-tick stock-quote-meta log-compaction Raw-tick stock-quote-ticker RocksDB Key value ING Raw-tick GOOGL Raw-tick AAPL Raw-tick Key value ING Meta-data GOOGL Meta-data AAPL Meta-data GlobalKTableKStream
  • 16. Local development 16 • Docker • Kafka • Zookeeper • Kafka manager • All our Spring Boot applications • Producers for development • Custom Kafka command line producer • Lab project
  • 17. Spring Kafka 17 • Producing: • ProducerFactory • KafkaTemplate • “The producer is thread safe and sharing a single producer instance across threads will generally be faster than having multiple instances.” • Consuming • Kafka consumers are not thread safe • @KafkaListener • MessageListener (many different interfaces) • Access to ConsumerRecord • Access to manual control to commit the offset • Scale up multiple consumer (threads) within the application
  • 18. Spring Kafka 18 • Integration tests • Junit rule: EmbeddedKafkaRule • @EmbeddedKafka • Metrics • Kafka consumer metrics out of the box (Micrometer)
  • 19. Lessons learned 19 • Use Spring Kafka after you understand the Kafka APIs • Error handling • (De)serialization -> Apache Avro • Think about # of partitions per topic upfront if possible (routing) • Can your consumers keep up? Can you scale up? • Monitor your topics / streams in production • Based on metrics -> Micrometer
  • 20. Lessons learned 20 • Kafka clients are backward compatible with Kafka brokers • Kafka Streams • KTables • GlobalKTables • Interactive Queries • RocksDB build for ssd • Describe • processing.guarantee=exactly_once • Kafka topology • Plan ahead • small & multiple topologies
  • 22. Contact Tim van Baarsen Software Engineer @ ING @TimvanBaarsen Marcos Maia Software Engineer @ ING @thegroo