Find out more about our journey of migrating to MongoDB after using Oracle for our hotel search database for over ten years.
- How did we solve the synchronization problem with the Master Database?
- How to get fast search results (even with massive write operations)?
- How other issues were solved
11. 11
Our Search system
We used TimesTen as a cache server in 2009
Search Engine
Front Service
Search Engine
Search Engine
Push the same data each cluster
Oracle TimesTen
Oracle
12. 12
Traffic Analysis and Forecast
License Cost No Horizontal Scale-Out Duplicated Data
2013 2014 2015 2016 2017
Search Query (TPS)
2013 2014 2015 2016 2017
Data Size (GB)
13. 13
Verifications by POC (Proof of Concept)
Low
Latency
Flexibility
Cost
Efficiency
SLA 99.95%
Horizontal
Scale Out
Trouble
Shooting
Fault
Tolerance
MongoDB
Oracle
Coherence
Cassandra
Redis
MEMSQL
15. 15
Data Synchronization from Oracle to MongoDB
How we synchronize data into MongoDB
Oracle Kafka Consumers MongoDB
Sync Tables High throughput
Low latency
Scalability
Centralized
Real-time
Operate hundreds of Instances
Write 500 million messages a day
Avg. 7ms per 10 message
17. 17
Search MongoDB environment
Monitoring Grafana + Prometheus
Backup LVM snapshot + oplog
Log management logstash, logrotated, mtools
Enterprise function Audit, OpsManager
Config management Bitbucket + Confluence
tools
Shard
Physical
mongod
Physical
mongod
Physical
mongod
Routers
VM
mongos
VM
mongos
VM
mongos
Config Servers
VM
mongod
VM
mongod
VM
mongod
X 5
VM
mongos
API
VM
mongos
API
VM
API
VM
API
18. 18
What have we been through
2,000 QPS
Business Expected Load
8,000 QPS
Designed Load
100,000 QPS
Actual Load
1250%
3120%
24. 24
Retryable Writes
retryWrites : true
After retrying then send message to new master
Response time to write
Consumers
Primary
Secondary
à Primary
Write
API services
Read
Down
Secondary
28. 28
Write Concern settings (w Option)
w Option
The w option requests
acknowledgment that the write
operation has propagated to a
specified number of mongod
instances or to mongod instances
with specified tags.
Our initial setting
w : 1 (default)
Driver
Primary
Secondary
Secondary
write
Apply
Replication
w:0 w:1 w:2 (majority)
Response
Case of 3 nodes replica set
Apply
29. 29
Write Concern settings (w : 0)
We have to do something. Can we set w=0?
APP
DBA
If you want to take that risk, sure
30. 30
Trouble (w : 0)
Trouble
Primary nodes were downed by high load.
31. 31
Trouble (w : 0)
Driver
Primary
Secondary
Secondary
write
Apply
Response
'Dirty cache' size grew much larger
WiredTigerLAS.wt became too big
("LAS" == lookaside, a.k.a WT cache overflow.)
Apply
34. 34
Write Concern settings (j : false)
journal
memory
disk
When w: <number>
default of j is false
(Acknowledgment requires
writing operation in memory)
j Option
The j option requests
acknowledgment from MongoDB that
the write operation has been written
to the on-disk journal.
Our initial setting
j : true
100ms
Writes (j:true)
Force sync
Writes (j:false)
writes
Journal Commit
37. 37
Great new features of MongoDB 4.0
Multi-Document
ACID
Transactions
Aggregation
Pipeline Type
Conversions
Non-Blocking
Secondary Reads
40% Faster Data
Migrations
Extensions to
Change Streams
and so forth
MongoDB (2019.05.14) https://www.mongodb.com/blog/post/secondary-reads-mongodb-40
Multi-Document
ACID
Transactions
Aggregation
Pipeline Type
Conversions
Non-Blocking
Secondary Reads
40% Faster Data
Migrations
Extensions to
Change Streams
and so forth