SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Downloaden Sie, um offline zu lesen
Serverless and Streaming
- Building the auction platform
- Event driven architectures on Kafka
- FaaS for streaming
- Putting it in action
●
●
●
●
●
users
the world
selling
buying
the sketch
●
●
●
●
●
Auction items
Items being placed
1.
Bids against item ‘duran duran’
stream-table
join against ‘duran duran’
2.
Item ‘duran duran’
3.
CDC Stream
{ item:duran res: 100 bid: 125 buyer: michael }
{ item:duran res: 100 bid: 120 buyer: nick }
{ item:duran res: 100 bid: 121 buyer: damian }
{ item:duran res: 100 bid: 115 buyer: andy }
{ item:duran res: 100 bid: 110 buyer: andy }
KSQL: SELECT * from bidding-stream
where item=’duran duran’
4.
{...}
{...}
{...}
FaaSKafka cluster
stream
processing
Kafka Streams
KSQL
Producer/Consumer
SOMETHING
HAPPENED!
BEING EVENT-FIRST CHANGES HOW YOU
THINK ABOUT WHAT YOU ARE BUILDING
...more importantly...
1. Any (data) application can be a data flow
2. A series of events and reacting to those events
3. Kafka then becomes a database
● User signup
● Item bid
● Item sold
● Notify user
Neil bid: 100
Michael bid: 200
Ben bid: 200
>> SOLD!
store all events
replay all events
transactional
etc
Databases Databases
Customer
Data Updates
Unified 360
Merged Customer
Profiles
“Who bought what”
Events
Shoulders of Streaming Giants
subscribe(), poll(), send(),
flush(), beginTransaction(), …
KStream, KTable, filter(),
map(), flatMap(), join(),
aggregate(), transform(), …
CREATE STREAM, CREATE TABLE,
SELECT, JOIN, GROUP BY, SUM, …
KSQL UDFs
Ease of Use
Flexibility
Stream
processor
STREAM
/user-reg
FILTER
SELECT users > 18
PROJECT
SELECT user.name
JOIN
SELECT u.name, a.country
from user-reg u JOIN
address a WHERE u.id = a.id
GROUP BY (TABLE)
SELECT u.country,
count(u.name) FROM user-reg u
GROUP BY u.country
WINDOW (TABLE)
SELECT u.country, count(u.name)
FROM user-reg u WINDOW TUMBLING
(SIZE 1 MIN) group by u.country
STREAM
/address
5.
/bidding-history
{ item:duran res: 100 bid: 125 buyer: michael }
{ item:duran res: 100 bid: 120 buyer: nick }
{ item:duran res: 100 bid: 121 buyer: damian }
{ item:duran res: 100 bid: 115 buyer: andy }
{ item:duran res: 100 bid: 110 buyer: andy }
KSQL: SELECT * from
bidding-stream where
item=’duran duran’
6.
Auction items
3.
KSQL Table
Table
Bidding Status
stream-table
join
4.
Table
Kafka Streams - KTable
Kafka Topic
/bids (stream)
2.
Kafka Topic
/items (stream)
1.
SELECT u.country, count(u.name) FROM user-reg u
WINDOW TUMBLING (SIZE 1 MIN) GROUP BY u.country
KStream<String, String> userBids = builder.stream("stream-user-bids");
final KTable<String, Long> bidCount = userBids
.flatMapValues(value ->
Arrays.asList(pattern.split(value.toLowerCase()))
)
.groupBy((user, count) -> user)
.count();
bidCounts.toStream().to("streams-bid-count-output",
Produced.with(stringSerde, longSerde));
Model events not commands,
-> streams of events,
-> series of streams to model the domain
{
item-id: 389*
user: 100
type: bid
cat: bikes/mtb
region: dc-east
}
/bikes/mtb by item-id*
/bikes/ by dc-east‘-’item-id*
-
-
-
-
-
-
-
{
user: 100
type: bid
item: 389
cat: bikes/mtb
region: dc-east
}
/bikes/mtb by item-id
key#
partition
topic
key space
Low level analytics
counter
Producer/Consumer
Item Summary
Kafka Streams
User Activity
KSQL
/stream-1
/stream-2
join
Stream
processor
1. Ops:
2. Stream-based:
3. Data-based:
→
the log, event sourcing, source of truth,
CQRS, event collaboration, replayability,
at-least once, exactly one, evolutionary
architectures, data-virtualization and
more
{...}
●
●
●
●
● {...}
1.
stateless
2. Non-stream non-time
3. Analytics
4. Edge
5. incoming
outgoing
{...}
●
●
●
●
●
{...}
{...}
{...}
{...}
the log the log
Event sourcing:
How did we get here?
{...}
{...}
{...}
{...}
bad stream
- Enrich users on signup (address validation)
- Geo-enrich items on placement (city, state, lat-lon cell identification)
- Notify users on item sold or reserve not met
- Perform analytics on auction when item ‘completes’
- Notify user of items-of-interest from their history when browsing
- Ad-placement analytics (watched items, interested items, users-purchased
- Monte-carlo auction simulations to guide users and calc item trending scores
● Search
● Bid
● Item-Complete
● Marketplace analytics
Auction items
Items being placed
1.
Bids against item ‘duran duran’
stream-table
join against ‘duran duran’
2.
Item ‘duran duran’
3.
/bidding-stream
{ item:duran res: 100 bid: 125 buyer: michael }
{ item:duran res: 100 bid: 120 buyer: nick }
{ item:duran res: 100 bid: 121 buyer: damian }
{ item:duran res: 100 bid: 115 buyer: andy }
{ item:duran res: 100 bid: 110 buyer: andy }
KSQL: SELECT * from bidding-stream
where item=’duran duran’
4.
4. KStream: Interactive query
3. Table: Materialized view
topic: /auction/records/80sSearch: Identify set of topics
1.
2. Locate KTables
1. Stream processor runs ‘future’ on
local-state of item-bids
auction items
3. Rejoined
removes item
4. Stream triggers FaaS
complete item processor
bid-history
Stream table join
5. FaaS Notify all bidders
bid-notifications
2.
Rewrite ‘completed’ item status
to retrigger join
item status
● How is the item trending? Banding on condition (new, as-new, used)
● What’s the usual bid-offer spread?
● Frequency of sale?
● Percentiles?
{...}
{...}
{...}
{ bid:100; sold:1000;}
/bid-history
{
stream-lib.TDigest(values[])
}
{
stream-lib.TDigest(values[])
}
{
stream-lib.TDigest(values[])
}
Calculating percentiles using the ‘unit-of-work’ pattern
{
digest.merge(digest)
}
{...}
/auction/items
{...}
{ item:100;}
Stream
processor
1. Items
{ bid:100;}
{...} Stream
processor
/auction/bids
2. Bidding
{...}
notify bidders & seller
{ item:100; offer:101}
/auction/bids/history
{...}
analytics for bidders
3. Processing
● Event-First
● Streams →
→
● App Infra
● FaaS
Event-first forces you to think about behaviour of the system
Event sourcing captures that behaviour
● Stream processing:
● Streaming platform:
● Closer affinity:
● FaaS
Serverless and stream processing
Building Ebay using Serverless and stream processing - Big Data London November 2018

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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...
 
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...
 
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
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
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)
 

Empfohlen (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
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
 

Building Ebay using Serverless and stream processing - Big Data London November 2018

  • 2. - Building the auction platform - Event driven architectures on Kafka - FaaS for streaming - Putting it in action
  • 3.
  • 6. Auction items Items being placed 1. Bids against item ‘duran duran’ stream-table join against ‘duran duran’ 2. Item ‘duran duran’ 3. CDC Stream { item:duran res: 100 bid: 125 buyer: michael } { item:duran res: 100 bid: 120 buyer: nick } { item:duran res: 100 bid: 121 buyer: damian } { item:duran res: 100 bid: 115 buyer: andy } { item:duran res: 100 bid: 110 buyer: andy } KSQL: SELECT * from bidding-stream where item=’duran duran’ 4.
  • 8.
  • 9.
  • 11.
  • 12. BEING EVENT-FIRST CHANGES HOW YOU THINK ABOUT WHAT YOU ARE BUILDING ...more importantly...
  • 13. 1. Any (data) application can be a data flow 2. A series of events and reacting to those events 3. Kafka then becomes a database ● User signup ● Item bid ● Item sold ● Notify user Neil bid: 100 Michael bid: 200 Ben bid: 200 >> SOLD! store all events replay all events transactional etc
  • 14. Databases Databases Customer Data Updates Unified 360 Merged Customer Profiles “Who bought what” Events
  • 15. Shoulders of Streaming Giants subscribe(), poll(), send(), flush(), beginTransaction(), … KStream, KTable, filter(), map(), flatMap(), join(), aggregate(), transform(), … CREATE STREAM, CREATE TABLE, SELECT, JOIN, GROUP BY, SUM, … KSQL UDFs Ease of Use Flexibility
  • 16. Stream processor STREAM /user-reg FILTER SELECT users > 18 PROJECT SELECT user.name JOIN SELECT u.name, a.country from user-reg u JOIN address a WHERE u.id = a.id GROUP BY (TABLE) SELECT u.country, count(u.name) FROM user-reg u GROUP BY u.country WINDOW (TABLE) SELECT u.country, count(u.name) FROM user-reg u WINDOW TUMBLING (SIZE 1 MIN) group by u.country STREAM /address
  • 17. 5. /bidding-history { item:duran res: 100 bid: 125 buyer: michael } { item:duran res: 100 bid: 120 buyer: nick } { item:duran res: 100 bid: 121 buyer: damian } { item:duran res: 100 bid: 115 buyer: andy } { item:duran res: 100 bid: 110 buyer: andy } KSQL: SELECT * from bidding-stream where item=’duran duran’ 6. Auction items 3. KSQL Table Table Bidding Status stream-table join 4. Table Kafka Streams - KTable Kafka Topic /bids (stream) 2. Kafka Topic /items (stream) 1.
  • 18. SELECT u.country, count(u.name) FROM user-reg u WINDOW TUMBLING (SIZE 1 MIN) GROUP BY u.country
  • 19. KStream<String, String> userBids = builder.stream("stream-user-bids"); final KTable<String, Long> bidCount = userBids .flatMapValues(value -> Arrays.asList(pattern.split(value.toLowerCase())) ) .groupBy((user, count) -> user) .count(); bidCounts.toStream().to("streams-bid-count-output", Produced.with(stringSerde, longSerde));
  • 20. Model events not commands, -> streams of events, -> series of streams to model the domain { item-id: 389* user: 100 type: bid cat: bikes/mtb region: dc-east } /bikes/mtb by item-id* /bikes/ by dc-east‘-’item-id* - - - - - - -
  • 21. { user: 100 type: bid item: 389 cat: bikes/mtb region: dc-east } /bikes/mtb by item-id key# partition topic key space Low level analytics counter Producer/Consumer Item Summary Kafka Streams User Activity KSQL
  • 23. 1. Ops: 2. Stream-based: 3. Data-based: →
  • 24. the log, event sourcing, source of truth, CQRS, event collaboration, replayability, at-least once, exactly one, evolutionary architectures, data-virtualization and more
  • 25. {...}
  • 27. 1. stateless 2. Non-stream non-time 3. Analytics 4. Edge 5. incoming outgoing {...}
  • 29. {...} {...} {...} the log the log Event sourcing: How did we get here?
  • 31. - Enrich users on signup (address validation) - Geo-enrich items on placement (city, state, lat-lon cell identification) - Notify users on item sold or reserve not met - Perform analytics on auction when item ‘completes’ - Notify user of items-of-interest from their history when browsing - Ad-placement analytics (watched items, interested items, users-purchased - Monte-carlo auction simulations to guide users and calc item trending scores
  • 32.
  • 33.
  • 34. ● Search ● Bid ● Item-Complete ● Marketplace analytics
  • 35. Auction items Items being placed 1. Bids against item ‘duran duran’ stream-table join against ‘duran duran’ 2. Item ‘duran duran’ 3. /bidding-stream { item:duran res: 100 bid: 125 buyer: michael } { item:duran res: 100 bid: 120 buyer: nick } { item:duran res: 100 bid: 121 buyer: damian } { item:duran res: 100 bid: 115 buyer: andy } { item:duran res: 100 bid: 110 buyer: andy } KSQL: SELECT * from bidding-stream where item=’duran duran’ 4.
  • 36. 4. KStream: Interactive query 3. Table: Materialized view topic: /auction/records/80sSearch: Identify set of topics 1. 2. Locate KTables
  • 37. 1. Stream processor runs ‘future’ on local-state of item-bids auction items 3. Rejoined removes item 4. Stream triggers FaaS complete item processor bid-history Stream table join 5. FaaS Notify all bidders bid-notifications 2. Rewrite ‘completed’ item status to retrigger join item status
  • 38. ● How is the item trending? Banding on condition (new, as-new, used) ● What’s the usual bid-offer spread? ● Frequency of sale? ● Percentiles? {...} {...} {...} { bid:100; sold:1000;} /bid-history { stream-lib.TDigest(values[]) } { stream-lib.TDigest(values[]) } { stream-lib.TDigest(values[]) } Calculating percentiles using the ‘unit-of-work’ pattern { digest.merge(digest) } {...}
  • 39. /auction/items {...} { item:100;} Stream processor 1. Items { bid:100;} {...} Stream processor /auction/bids 2. Bidding {...} notify bidders & seller { item:100; offer:101} /auction/bids/history {...} analytics for bidders 3. Processing
  • 40.
  • 41. ● Event-First ● Streams → → ● App Infra ● FaaS
  • 42. Event-first forces you to think about behaviour of the system Event sourcing captures that behaviour
  • 43.
  • 44. ● Stream processing: ● Streaming platform: ● Closer affinity: ● FaaS
  • 45. Serverless and stream processing