1
Firenze, 25 Settembre
Loyalty cashback -‐ Scaling with MongoDB Salvatore Incandela
2
About Me
IT Architecture
Agile Open
Source
NoSql
R&D
Security
Big Data
DDD
CQRS
Electronic Money
Change Management
Continous Improvement
Organization
Paybay - Copyright 2014 - All Right Reserved
3
Agenda • Context
• Problem Setting
• Problem Solving
• Problem Solved
• MongoDb Focus
• MongoDb Cluster Config
• MongoDb Cluster Status
• Our Loyalty Clients
• Next Steps
Paybay - Copyright 2014 - All Right Reserved
4
Context
Loyalty Cashback Program, how it works:
Card Holder Buy Affiliated Merchant
Acquires Transaction
Bank Send
Transaction
Give Rewards
Loyalty Platform
Paybay - Copyright 2014 - All Right Reserved
5
Card Holder
Context
Big Loyalty Cashback Program
Very Big!!
10Mln 50k+
2+Mln per day
1,5+Mln per day
50k+ per day
1,5+Mln per day
Buy Affiliated Merchant
Acquires Transaction
Bank Send
Transaction
Give Rewards
Loyalty Platform
Paybay - Copyright 2014 - All Right Reserved
6
Context
Big Loyalty Cashback Program
Very Big!!
Card Holder Affiliated Merchant Buy
Bank Send Transactions Loyalty Platform
Give Rewards Acquires Transactions
10Mln 50k+
2+Mln per day
1,5+Mln per day
50k+ per day
1,5+Mln per day
Just for one Bank but…
….the platform will be multitenant!
Paybay - Copyright 2014 - All Right Reserved
7
Problem Setting
• FrontEnd performances
• BackEnd performances
• High scalability costs
• Lack of Smart Business and Operational Analitics
• Shared DataStores causes poor performances
Paybay - Copyright 2014 - All Right Reserved
8
Problem Setting
RDBMS
Batch Engine
Core Services
Data Acces Layer
WebApps
Performances Budget Analitics Mobile Web
Services
Is this solution economically sustainable? How to Scale the Data Store?
Paybay - Copyright 2014 - All Right Reserved
9
Problem Solving
RDBMS RDBMS
Performances Budget Analitics Batch Engine
Core Services
Data Acces Layer
WebApps Mobile Web Services
ß Not for Us
Paybay - Copyright 2014 - All Right Reserved
10
Problem Solving
CQRS originally introduced by Greg Young
Martin Fowler http://martinfowler.com/bliki/CQRS.html
The change that CQRS introduces is to split the conceptual model into separate models for update and display, which it refers to as Command and Query respectively following the vocabulary of CommandQuerySeparation. The rationale is that for many problems, particularly in more complicated domains, having the same conceptual model for commands and queries leads to a more complex model that does neither well.
Paybay - Copyright 2014 - All Right Reserved
11
Problem Solving fase 1
MongoDb
Performances Budget Analitics
Document Modeled Fast Reads to more performances Business Analitics collections Operational Analitics Collections
E/R Modeled Reliable Strong Competencies
CQRS Principle transitions
Batch Engine
Data Acces Layer
WebApps Mobile Web Services
Core Services Commands Reads
ß Only for Fast Reads RDBMS
Paybay - Copyright 2014 - All Right Reserved
12
MongoDb
Performances Budget Analitics
CQRS Principle transitions
MongoDb MongoDb
More Reliable configuration
Batch Engine
Core Services
Data Acces Layer
WebApps Mobile Web Services
Commands Reads
Problem Solved!
RDBMS Still used
ß Only for Fast Reads RDBMS
Paybay - Copyright 2014 - All Right Reserved
13
MongoDb Focus
MongoDb MongoDb MongoDb
Noteworthy • MondoDb is flexible schema • De-normalized • MMS: Monitoring, Backup tools • Database Metrics, HW Statistics • OOP Oriented no ORM Mappings
Paybay - Copyright 2014 - All Right Reserved
14
MongoDb Cluster Config
MongoDb MongoDb MongoDb
Cluster Configuration • 3 Node • Replica Set • 9 Collections (the biggest contains 700mln raw data) • Compound Index • Background indexes • TTL Indexes
Paybay - Copyright 2014 - All Right Reserved
15
MongoDb Cluster Status
Manage Tb of Data • Up and running about 3 years without fault • Increase Reads parformances up to 60% • Decrease costs about 70% • Self Learned: good documentations
MongoDb MongoDb MongoDb
Paybay - Copyright 2014 - All Right Reserved
16
Our Loyalty Clients
Paybay - Copyright 2014 - All Right Reserved
17
Next Steps?
MongoDb MongoDb MongoDb
We’ll adopt MongoDb as Fast Read DataStore for the entire Blue Tiger Platform
MongoDb MongoDb MongoDb
MongoDb MongoDb MongoDb
Loyalty Couponing Ticketing Payments Issuing
800Mln Trx per Year
150k Clients
800k Trx per Year
10Mln Trx per Year
1Mln Cards per Year
MongoDb MongoDb MongoDb
MongoDb MongoDb MongoDb
MongoDb MongoDb MongoDb
MongoDb MongoDb MongoDb
Paybay - Copyright 2014 - All Right Reserved
18
Contacts
{ name: “Salvatore Incandela”, twitter: “@sincandela”, email: “[email protected]”, linkedin: “https://www.linkedin.com/in/salvatoreincandela”}
Paybay - Copyright 2014 - All Right Reserved
Grazie
Q&A