Top Banner
[email protected] Teddy Chan CEO& Co-Founder
24
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

[email protected]

Teddy ChanCEO& Co-Founder

Page 2: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Aftership’s Mongodb Replicain AWS

- The replica architect design

- Tricks for best C/P

- Optimization in OS & Query

- House Keeping

Page 3: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Shipment tracking APISupporting 250+ carriers

Page 4: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Our clientsAPI users

Page 5: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

- 1M shipments (Jan 2014)

- 12M shipments (Jan 2015)

- 100M shipments (Est. Jan 2016)

- API uptime over 99.99%

StatsNumber of shipments tracked

Page 6: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

- Lots of instance types

c3, m1, m2, m3, r3, i2, d2, from micro to 8xlarge

- High availability: multi-zones

- Easy backup: Snapshot

Why Amazon

Page 7: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Our Replica Set

replication replication

Primaryzone A

i2.2xlarge

Secondaryzone C

r3.2xlarge

Secondaryzone C

i2.2xlarge

Page 8: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Our Replica Set

replication replication

Primaryzone A

Secondaryzone C

Secondaryzone B

i2.2xlarge

r3.2xlargei2.2xlarge

2 x 800 SSD

1024GB EBS2 x 800 SSD

Page 9: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Tricks for best C/P

- Mix Instance Types

- Primary: SSD Instance storage

- Secondary: PIOPS SSD EBS

http://goo.gl/1FWDbb

http://goo.gl/HNfPfy

Page 10: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Tricks for best C/P

- Saving by using Instance StorageUSD388 x 2 x 12 month = USD9,312

- Saving by mixing instance typesUSD6237 – 3253 = USD2,984

- Save yearly USD12,296

Page 11: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Tricks for best C/P

- Use priority

- Take snapshot from Secondary EBS

Page 12: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Optimization in OSulimit

http://docs.mongodb.org/manual/reference/ulimit/

Page 13: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Optimization in OSReadAhead

https://comerford.cc/tag/readahead/

- Provisioned IOPS works with an IO request size of 16KB

- 16KB = 1.0 OP, 32KB = 2.0 OP, etc

Page 14: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Optimization in OSReadAhead

- Magnetic Disk

Best 16KB readahead

- SSD Disk

?

Page 15: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Optimization in OSReadAhead

- Magnetic Disk

Best 16KB readahead

- SSD Disk

ZERO!

Page 16: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

Optimization in Query.hint()

Page 17: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

- Using .hint() in query

- Using Index Filter Ignore .hint() in query

Do not persist after instance shutdown

Optimization in Query.hint()

Page 18: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

- Specify max time limit in ms for processing operations in server side

Optimization in Query.maxTimeMS()

Page 19: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

House Keeping/log

Page 20: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

House Keeping/log

logrotate

https://goo.gl/WuncmN

Page 21: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

House Keeping/log

logrotate

Page 22: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

What we getPrimary i2.2xlarge 2 x 800 SSD RAID0

Page 23: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

What we getSecondary r3.2xlarge 1TB SSD 4000 PIOPS

Page 24: 2015 05-09 Deploy MongoDB ReplicaSet in AWS

http://www.slideshare.net/aftership

FAQ