This talk will go over why we chose to use MongoDB for storing billions of documents with only 3 replset nodes, and why we choose MongoDB for our report data store instead of MySQL.
6. Why—Speed
RDB is poor of performance while there is huge data
{“CPU”:” Intel(R) Core(TM)2 Duo CPU E7200 @
2.53GHz”,
”RAM”:”8G DDR2 667”,
”Disk”:”SATA”,
”OS”:”Redhat 5.5”}
14. Why– Other
Huge data will grow fast
No transaction
A little complex query
Index support
Multiple language support
Auto sharding
Map/Reduce support
GridFS
16. How – ODM
Use ODM to minimize the cost of learning
Spring Data,
Morm(https://github.com/macrohuang/mongo-orm)
and so on
17. How – Cluster
Always use replica set
Reading from a secondary (however, you will need to
deal with possible eventual consistency depending on
the write concern)
Kill them first,
they are copied
from me.
18. How – Replica Set
Always assign replica set priority
19. How – Key design
Keep document key short to save space
21. How – Sort rule
Never sort on un-index field with lots of result
22. How – Index
Keep all your indexes in RAM(for maximum
performance, but not required)
23. What – TPS
Report transaction(Business transaction)
Transaction per second
+29%
100
80
60 Transaction per
second
40
20
0
Oracle MongoDB
24. What – Response time
Report system max response time
Max Response Time
100 -28.55%
80
60
Max Response Time
40
20
0
Oracle MongoDB
25. What – CPU I/O
Report system CPU I/O wait
CPU I/O wait
100
-43%
80
60 CPU I/O wait
40
20
0
Oracle MongoDB
26. What – CPU
Report system CPU idle
CPU idle
+80%
100
80
60 CPU idle
40
20
0
Oracle MongoDB
27. What – Log system
3 nodes replica set storing 2 billion documents
12 million documents grow everyday
100 thousand query request within 2 seconds average
response time