SlideShare a Scribd company logo
1 of 21
Download to read offline
Hey, where'd my money go?
Building Airbnb's Financial Data Pipeline in Spark
Mike Lewis Jiang-Ming Yang
191 72 29
Countries Currencies Languages
Receipts
Payables
VAT
Revenue TOT
Financial
Data
Alexandria
____________________________
Ruby on Rails dashboard app
Nightly Cron job
Dynamically create MySQL
queries to ETL data
The good
Served us faithfully from 2012-2015
SQL queries are very easy to hand-test and share
Simple data can be handled with simple queries but...
...data doesn't stay simple forever
Each product is handled in a different way
Unscalable performance as data grew
Difficult to refactor complex SQL
The bad
Ever maintained a 1,000 line SQL query?
We needed:
____________________________
An actual programming language
A pipelined architecture
Distributed computing capabilities
Goals
• Handle all products using a common flow (ie. business trip or cleaning)
• Infer events from data or consume in realtime from production
• Easily query-able subledger output
Braavos
____________________________
Home of the Iron Bank
—Game of Thrones
Our next generation event-based financial
data processing system
Sub-ledger entries
• General accounts: receivable / payable / revenue / tax / etc.
• Debit/credit operation against a given account.
• Double-entry accounting rule
Sub-ledger entries
• A reservation for $100 comes in
• Platform events generated
• Debit/credit to appropriate subledgers
Debit Credit
Receivable (Guest) 100
Deferred Revenue 10
Deferred Payable 90
Debit Credit
Cash 100
Receivable (Guest) 100
PaymentBook
Debit Credit
Deferred Revenue 10
Revenue (Guest) 10
Deferred Payable 90
Payable (Host) 90
Revenue Recognition
1 2 3
• Payment call made to processor
• Payment broken into payment events
• Appropriate subledger entries made
• Finance policy determines revenue
recognition date
• Events generated to debit/credit appropriate
subledgers
Accounting entries
Booking entries based on financial policy
Reports
Simpler summary queries on subledgers.
Event generation
Normalized platform events
Normalized payment events
Braavos pipeline
Platform Events
Product Type
Product Id
Datetime
Guest Info
Host Info
Funding Sources
Itemized Pricing
Taxes (currency / amount / remittance currency)
Product Type
Product Id
Datetime
Transaction Id
Payment Info
Currency
Amount
Effective currency rate
Reconciled rate
Payment Events
Build in Spark / Scala
Finance system is an offline component and don’t need to worry about the
latency;
Developer can focus on the business logic and don’t need to worry about the
scalability;
Performance (throughput): 7M events / min
--conf spark.default.parallelism=200 
--num-executors 50 
--executor-cores 8
Reports
Guest Receivable Future Host Payout
SELECT sum(IF(Operation = `Debit`,
amount, -amount))
FROM subledger_entries
WHERE account = ‘ReceivableAccount’
AND meta[‘Guest’] IS NOT NULL
AND event_date < ‘2015-01-01’;
SELECT sum(IF(Operation = `credit`,
amount, -amount))
FROM subledger_entries
WHERE account = ‘PayableAccount’
AND meta[‘Host’] IS NOT NULL
AND event_date < ‘2015-01-01’;
SELECT sum(IF(Operation = `credit`, amount,
-amount))
FROM subledger_entries
WHERE account = ‘DeferredRevenueAccount’
AND event_date < ‘2015-01-01’;
Deferred Revenue
Migration Process
1. Generate all the platform events and payment events based on existing
database account audit records;
2. Build reports based on Braavos to match up the existing reports;
3. Changing the upstream components to generate real events and compare
with existing results;
4. Switch to use the real upstream events;
Intercompany report
Airbnb transactions involve four entities: Airbnb Inc. / Airbnb Payment Inc. /
Airbnb UK / Airbnb Ireland and the number is increasing.
Guest / Host may belong to the different entities and their payment entities
might be different as well.
We need to report intercompany money movement across entities.
Entity A Entity B
Intercompany
Inbound Outbound
Operation: Debit
Amount: $150
Operation: Credit
Amount: $200
Entity C
Operation: Credit
Amount: $120
Entity D
Operation: Debit
Amount: $170
Future Work
Cash Reconciliation
Tie out internal data
with processor data
Automate Treasury Rebalancing
Robo-trade currency and hedge
against market fluctuation
Automate Everything
Build out financial back-office tools to
give better insight into our business
Improve Monitoring/Alerting
We should catch data issues in
minutes, not days
Stream-Based Processing
Consume events in realtime
from our production apps
Questions?

More Related Content

What's hot

What's hot (20)

A Framework for Navigating Generative Artificial Intelligence for Enterprise
A Framework for Navigating Generative Artificial Intelligence for EnterpriseA Framework for Navigating Generative Artificial Intelligence for Enterprise
A Framework for Navigating Generative Artificial Intelligence for Enterprise
 
BuzzFeed Pitch Deck
BuzzFeed Pitch DeckBuzzFeed Pitch Deck
BuzzFeed Pitch Deck
 
The Real Estate Tech Insights Report
The Real Estate Tech Insights ReportThe Real Estate Tech Insights Report
The Real Estate Tech Insights Report
 
SEOmoz Pitch Deck July 2011
SEOmoz Pitch Deck July 2011SEOmoz Pitch Deck July 2011
SEOmoz Pitch Deck July 2011
 
Microsoft to Acquire LinkedIn: Overview for Investors
Microsoft to Acquire LinkedIn: Overview for InvestorsMicrosoft to Acquire LinkedIn: Overview for Investors
Microsoft to Acquire LinkedIn: Overview for Investors
 
Foursquare's 1st Pitch Deck
Foursquare's 1st Pitch DeckFoursquare's 1st Pitch Deck
Foursquare's 1st Pitch Deck
 
How to Write Clickass Presentations that Convert
How to Write Clickass Presentations that ConvertHow to Write Clickass Presentations that Convert
How to Write Clickass Presentations that Convert
 
The Creative Ai storm
The Creative Ai stormThe Creative Ai storm
The Creative Ai storm
 
Mint.com Pre-Launch Pitch Deck
Mint.com Pre-Launch Pitch DeckMint.com Pre-Launch Pitch Deck
Mint.com Pre-Launch Pitch Deck
 
Uber pitch deck
Uber pitch deckUber pitch deck
Uber pitch deck
 
Champion the Indian SaaS Story.pptx
Champion the Indian SaaS Story.pptxChampion the Indian SaaS Story.pptx
Champion the Indian SaaS Story.pptx
 
Get on Board
Get on BoardGet on Board
Get on Board
 
Coinbase Seed Round Pitch Deck
Coinbase Seed Round Pitch DeckCoinbase Seed Round Pitch Deck
Coinbase Seed Round Pitch Deck
 
Revolutionizing your Business with AI (AUC VLabs).pdf
Revolutionizing your Business with AI (AUC VLabs).pdfRevolutionizing your Business with AI (AUC VLabs).pdf
Revolutionizing your Business with AI (AUC VLabs).pdf
 
Uber Pitch Deck
Uber Pitch DeckUber Pitch Deck
Uber Pitch Deck
 
Pitch Deck Template for startups
Pitch Deck Template for startupsPitch Deck Template for startups
Pitch Deck Template for startups
 
Mixpanel - Our pitch deck that we used to raise $65M
Mixpanel - Our pitch deck that we used to raise $65MMixpanel - Our pitch deck that we used to raise $65M
Mixpanel - Our pitch deck that we used to raise $65M
 
Docsumo pitch deck
Docsumo pitch deckDocsumo pitch deck
Docsumo pitch deck
 
Front Series B Deck
Front Series B DeckFront Series B Deck
Front Series B Deck
 
Blueprint for Executive Hiring
Blueprint for Executive HiringBlueprint for Executive Hiring
Blueprint for Executive Hiring
 

Similar to Airbnb - Braavos - Whered My Money Go

VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1
viswa pavan
 
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
Jared Flanders
 
Business Intelligence Resume - Sam Kamara
Business Intelligence Resume - Sam KamaraBusiness Intelligence Resume - Sam Kamara
Business Intelligence Resume - Sam Kamara
skamara1
 
Resume-18-5-16
Resume-18-5-16Resume-18-5-16
Resume-18-5-16
Anuj Kumar
 
Kathlenn Gaw - Consultant Profile
Kathlenn Gaw - Consultant ProfileKathlenn Gaw - Consultant Profile
Kathlenn Gaw - Consultant Profile
Kathlenn Gaw
 
Kafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appKafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming app
Neil Avery
 
The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...
confluent
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
confluent
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming app
Neil Avery
 
Navjot_Resume_2017_Latest
Navjot_Resume_2017_LatestNavjot_Resume_2017_Latest
Navjot_Resume_2017_Latest
Navjot Thakur
 

Similar to Airbnb - Braavos - Whered My Money Go (20)

VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1VISWAPAVAN _2015_v1
VISWAPAVAN _2015_v1
 
CV
CVCV
CV
 
pravin_1yr_exp
pravin_1yr_exppravin_1yr_exp
pravin_1yr_exp
 
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
2-1 Remember the Help Desk with AFCU - Jared Flanders, Final
 
Business Intelligence Resume - Sam Kamara
Business Intelligence Resume - Sam KamaraBusiness Intelligence Resume - Sam Kamara
Business Intelligence Resume - Sam Kamara
 
Ahmed ElSherbiny - CV
Ahmed ElSherbiny - CVAhmed ElSherbiny - CV
Ahmed ElSherbiny - CV
 
Resume-18-5-16
Resume-18-5-16Resume-18-5-16
Resume-18-5-16
 
Mstr meetup
Mstr meetupMstr meetup
Mstr meetup
 
annukurni_resume
annukurni_resumeannukurni_resume
annukurni_resume
 
Kathlenn Gaw - Consultant Profile
Kathlenn Gaw - Consultant ProfileKathlenn Gaw - Consultant Profile
Kathlenn Gaw - Consultant Profile
 
Kafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming appKafka summit SF 2019 - the art of the event-streaming app
Kafka summit SF 2019 - the art of the event-streaming app
 
The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...The art of the event streaming application: streams, stream processors and sc...
The art of the event streaming application: streams, stream processors and sc...
 
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
The Art of The Event Streaming Application: Streams, Stream Processors and Sc...
 
Kakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming appKakfa summit london 2019 - the art of the event-streaming app
Kakfa summit london 2019 - the art of the event-streaming app
 
Building a SaaS based product in Azure - Challenges and decisions made
Building a SaaS based product in Azure - Challenges and decisions madeBuilding a SaaS based product in Azure - Challenges and decisions made
Building a SaaS based product in Azure - Challenges and decisions made
 
Resume_Prabir
Resume_PrabirResume_Prabir
Resume_Prabir
 
Navjot_Resume_2017_Latest
Navjot_Resume_2017_LatestNavjot_Resume_2017_Latest
Navjot_Resume_2017_Latest
 
Naseer Muhammed AG_CV
Naseer Muhammed AG_CVNaseer Muhammed AG_CV
Naseer Muhammed AG_CV
 
Resume nistha
Resume nisthaResume nistha
Resume nistha
 
Presented at useR! 2010
Presented at useR! 2010Presented at useR! 2010
Presented at useR! 2010
 

Airbnb - Braavos - Whered My Money Go

  • 1. Hey, where'd my money go? Building Airbnb's Financial Data Pipeline in Spark
  • 3. 191 72 29 Countries Currencies Languages
  • 5. Alexandria ____________________________ Ruby on Rails dashboard app Nightly Cron job Dynamically create MySQL queries to ETL data
  • 6. The good Served us faithfully from 2012-2015 SQL queries are very easy to hand-test and share Simple data can be handled with simple queries but... ...data doesn't stay simple forever Each product is handled in a different way Unscalable performance as data grew Difficult to refactor complex SQL The bad Ever maintained a 1,000 line SQL query?
  • 7. We needed: ____________________________ An actual programming language A pipelined architecture Distributed computing capabilities
  • 8. Goals • Handle all products using a common flow (ie. business trip or cleaning) • Infer events from data or consume in realtime from production • Easily query-able subledger output
  • 9. Braavos ____________________________ Home of the Iron Bank —Game of Thrones Our next generation event-based financial data processing system
  • 10. Sub-ledger entries • General accounts: receivable / payable / revenue / tax / etc. • Debit/credit operation against a given account. • Double-entry accounting rule
  • 11. Sub-ledger entries • A reservation for $100 comes in • Platform events generated • Debit/credit to appropriate subledgers Debit Credit Receivable (Guest) 100 Deferred Revenue 10 Deferred Payable 90 Debit Credit Cash 100 Receivable (Guest) 100 PaymentBook Debit Credit Deferred Revenue 10 Revenue (Guest) 10 Deferred Payable 90 Payable (Host) 90 Revenue Recognition 1 2 3 • Payment call made to processor • Payment broken into payment events • Appropriate subledger entries made • Finance policy determines revenue recognition date • Events generated to debit/credit appropriate subledgers
  • 12. Accounting entries Booking entries based on financial policy Reports Simpler summary queries on subledgers. Event generation Normalized platform events Normalized payment events
  • 14. Platform Events Product Type Product Id Datetime Guest Info Host Info Funding Sources Itemized Pricing Taxes (currency / amount / remittance currency) Product Type Product Id Datetime Transaction Id Payment Info Currency Amount Effective currency rate Reconciled rate Payment Events
  • 15. Build in Spark / Scala Finance system is an offline component and don’t need to worry about the latency; Developer can focus on the business logic and don’t need to worry about the scalability; Performance (throughput): 7M events / min --conf spark.default.parallelism=200 --num-executors 50 --executor-cores 8
  • 16. Reports Guest Receivable Future Host Payout SELECT sum(IF(Operation = `Debit`, amount, -amount)) FROM subledger_entries WHERE account = ‘ReceivableAccount’ AND meta[‘Guest’] IS NOT NULL AND event_date < ‘2015-01-01’; SELECT sum(IF(Operation = `credit`, amount, -amount)) FROM subledger_entries WHERE account = ‘PayableAccount’ AND meta[‘Host’] IS NOT NULL AND event_date < ‘2015-01-01’; SELECT sum(IF(Operation = `credit`, amount, -amount)) FROM subledger_entries WHERE account = ‘DeferredRevenueAccount’ AND event_date < ‘2015-01-01’; Deferred Revenue
  • 17. Migration Process 1. Generate all the platform events and payment events based on existing database account audit records; 2. Build reports based on Braavos to match up the existing reports; 3. Changing the upstream components to generate real events and compare with existing results; 4. Switch to use the real upstream events;
  • 18. Intercompany report Airbnb transactions involve four entities: Airbnb Inc. / Airbnb Payment Inc. / Airbnb UK / Airbnb Ireland and the number is increasing. Guest / Host may belong to the different entities and their payment entities might be different as well. We need to report intercompany money movement across entities.
  • 19. Entity A Entity B Intercompany Inbound Outbound Operation: Debit Amount: $150 Operation: Credit Amount: $200 Entity C Operation: Credit Amount: $120 Entity D Operation: Debit Amount: $170
  • 20. Future Work Cash Reconciliation Tie out internal data with processor data Automate Treasury Rebalancing Robo-trade currency and hedge against market fluctuation Automate Everything Build out financial back-office tools to give better insight into our business Improve Monitoring/Alerting We should catch data issues in minutes, not days Stream-Based Processing Consume events in realtime from our production apps