Breaking the oracle tie
-
Upload
agiamas -
Category
Technology
-
view
519 -
download
1
Transcript of Breaking the oracle tie
![Page 1: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/1.jpg)
1
Breaking the Oracle tie; High Performance OLTP and analytics using MongoDB
Alexandros GiamasSenior Software Engineer
![Page 2: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/2.jpg)
Persado: Proven Value - Worldwide
Skype
$500 MILLION
Incremental Revenue
30+Premium Brands
20+Worldwide Languages
40+Countries
500M+
Engaged Consumers
100%Average Conversion
Lift
![Page 3: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/3.jpg)
4
Can you afford to leave half the opportunity on the table?
You won't believe itPick an Online Number! Why you'll love your Online Number: 1. Your friends without VoIP can call you 2. You answer on VoIP 3. You also have voicemail included
I like that!
2.07%
You won't believe itPick an Online Number! Why get an Online Number: 1. Your friends without VoIP can call you 2. You answer on VoIP 3. You also have voicemail included
I like that!
1.42%
You won't believe itThey dial, you answer on VoIP! Why you'll love your Online Number: 1. Family & friends without VoIP can call you 2. You answer on VoIP 3. And you can use it from anywhere in the world
I like that!
1.11%
…another 16 Million + combinations
![Page 4: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/4.jpg)
The Marketing Communication Suite
We Generate the marketing messages that work best.For any customer, any product, at any time.
![Page 5: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/5.jpg)
Persado History
Oracle shop
![Page 6: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/6.jpg)
Persado History
![Page 7: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/7.jpg)
Persado History
• Exponentially growing dataset• Data value/KB?
![Page 8: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/8.jpg)
Persado History
Not anymore...
![Page 9: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/9.jpg)
Persado History
Transactional Data and Analytics
![Page 10: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/10.jpg)
Transaction (Re)-defined
Social, Mobile, Email, Web, Display, Search
Which one stands out?
![Page 11: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/11.jpg)
Conversational and Transactional PropertiesWeb based channels
![Page 12: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/12.jpg)
Mobile Text Messaging
Conversational and Transactional Properties
![Page 13: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/13.jpg)
Flexi-structured data
One User across campaigns and mediums
{"_id" : ObjectId("511e3cbea9f1fd01fbd51c67"),"domain" : DBRef("Domain", NumberLong(3)),"locale" : "en","msisdn" : "59210000000","email" : "[email protected]","mobileInfo" : {"State" : "CA"},"emailInfo" : { "referral" : "www.google.com" },"expclk" : { "h" : 0.05, "d" : 0.02 }
}
![Page 14: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/14.jpg)
Overall Architecture - Data flow
![Page 15: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/15.jpg)
Sizing transactional data
☛ User Terminated data☛ User Originated data☛ Metadata (state for User per campaign and globally)☛ Must hold data in memory, or at least indexes
![Page 16: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/16.jpg)
ETL for OLAP
Offline / Online processing•Going online is mostly simpler•Offline must take into account data irregularities (data validation policy driven by business needs)
![Page 17: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/17.jpg)
ETL for OLAP
☛Custom Data transformation☛Custom “continueOnError” implementation
![Page 18: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/18.jpg)
Analytics
First cut- Custom js server-side using $where
![Page 19: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/19.jpg)
Analytics
GWLGlobal Write Lock
![Page 20: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/20.jpg)
Analytics In the real world
![Page 21: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/21.jpg)
Your own mini transactions
Break down Spring Batch steps in idempotent and non idempotent ones•For idempotent steps, just replay them•For non idempotent, replace current state with last known good state before latest spring batch step invocation (undo log) and retry the step
![Page 22: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/22.jpg)
Your own mini transactions Issues•16MB document size limit...•Slow to replay•Hard to test using Selenium
![Page 23: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/23.jpg)
Analytics In the real world
Map Reduce Implementation
![Page 24: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/24.jpg)
Analytics In the real world
Caching layers✓ Caching in collections
![Page 25: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/25.jpg)
Analytics In the real world
Caching layers✓ Caching in ehcache
![Page 26: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/26.jpg)
Analytics using the Aggregation Framework{$project: { "rdd": {
$isoDate: { year: {$year:"$_id.receivedDateHour"}, month: {$month:"$_id.receivedDateHour"}, dayOfMonth: {$dayOfMonth:"$_id.receivedDateHour"},
hour: {$hour:"$_id.receivedDateHour"} }
}, "value.diffDaysSum.0":1, "value.diffDaysSum.1":1, "value.diffDaysSum.2":1
} }, {$project: {rdd:1, diffDaysSum : {$add : ["$value.diffDaysSum.0",
"$value.diffDaysSum.1", "$value.diffDaysSum.2" ] } } },{$group: {
_id:"$rdd", totalSumPerDay: { $sum: "$diffDaysSum" } } }
![Page 27: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/27.jpg)
Analytics using the Aggregation Framework
Double project phase, followed by grouping results
![Page 28: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/28.jpg)
Analytics using the Aggregation Framework
Pros:✓ More flexible than it sounds✓ Rapid development✓ Easy debugging
Cons:✘ No custom js supported ✘ Memory limitation✘ API still evolving
![Page 29: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/29.jpg)
Fine grained write semantics and asynchronous magic
Fine grained write semantics• WriteConcern.SAFE for most writes• WriteConcern.REPLICAS_SAFE for writes that are costly
to recompute in case of failure
Reactive Mongo • Asynchronous and non blocking scala driver for
MongoDB• Async writes with WriteConcern.SAFE and callback retry
policy in case of error
![Page 30: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/30.jpg)
Lessons LearnedUse
replica setsJournalingAggregation FrameworkMMS
Don't useDevelopment versions across the teamUnbound datasets that can't fit in memoryMapReduce if you don't need to
![Page 31: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/31.jpg)
MongoDB on EC2
4 nodes with 6 mongod processes
![Page 32: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/32.jpg)
MongoDB on EC2 Using LVM's
http://goo.gl/8NbV7
For high performance, use LVM's with RAID 0 or 10Have your guerilla team ready:
![Page 33: Breaking the oracle tie](https://reader036.fdocuments.net/reader036/viewer/2022062419/55889754d8b42a367d8b4592/html5/thumbnails/33.jpg)
MongoDB on EC2 Lesson Learned
Unix level tweaks:• Raise ulimit• Raise tcp timeout• Noatime nodirtime• Use XFS or ext4• Use LVM for snapshotting
Use journaling