2015 05-09 deploy mongodb replicaset in aws

24
[email protected] Teddy Chan CEO& Co-Founder

Upload: aftership

Post on 03-Aug-2015

122 views

Category:

Technology


3 download

TRANSCRIPT

[email protected]

Teddy ChanCEO& Co-Founder

Aftership’s Mongodb Replicain AWS

- The replica architect design

- Tricks for best C/P

- Optimization in OS & Query

- House Keeping

Shipment tracking APISupporting 250+ carriers

Our clientsAPI users

- 1M shipments (Jan 2014)

- 12M shipments (Jan 2015)

- 100M shipments (Est. Jan 2016)

- API uptime over 99.99%

StatsNumber of shipments tracked

- Lots of instance types

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

- High availability: multi-zones

- Easy backup: Snapshot

Why Amazon

Our Replica Set

replication replication

Primaryzone A

i2.2xlarge

Secondaryzone C

r3.2xlarge

Secondaryzone C

i2.2xlarge

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

Tricks for best C/P

- Mix Instance Types

- Primary: SSD Instance storage

- Secondary: PIOPS SSD EBS

http://goo.gl/1FWDbb

http://goo.gl/HNfPfy

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

Tricks for best C/P

- Use priority

- Take snapshot from Secondary EBS

Optimization in OSulimit

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

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

Optimization in OSReadAhead

- Magnetic Disk

Best 16KB readahead

- SSD Disk

?

Optimization in OSReadAhead

- Magnetic Disk

Best 16KB readahead

- SSD Disk

ZERO!

Optimization in Query.hint()

- Using .hint() in query

- Using Index Filter Ignore .hint() in query

Do not persist after instance shutdown

Optimization in Query.hint()

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

Optimization in Query.maxTimeMS()

House Keeping/log

House Keeping/log

logrotate

https://goo.gl/WuncmN

House Keeping/log

logrotate

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

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

http://www.slideshare.net/aftership

FAQ