Five Things you Need to Know About Scaling
 

Five Things you Need to Know About Scaling

on

  • 500 views

 

Statistics

Views

Total Views
500
Views on SlideShare
327
Embed Views
173

Actions

Likes
1
Downloads
28
Comments
1

4 Embeds 173

http://www.mongodb.com 158
https://www.mongodb.com 13
https://live.mongodb.com 1
https://comwww-drupal.10gen.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Five Things you Need to Know About Scaling Five Things you Need to Know About Scaling Presentation Transcript

  • The 5 Things You Need To Know About Scaling A. Jesse Jiryu Davis
 
 Senior Python Engineer
  • 1. Indexes
  • db.people.find({name: 'Jesse'}).explain()! {! ! "cursor" : "BasicCursor",! ! "n" : 10,! ! "nscanned" : 100000,! ! "millis" : 40,! }! ! db.people.createIndex({name: 1});! ! db.people.find({name: 'Jesse'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 10,! ! "nscanned" : 10,! ! "millis" : 0,! }! 1. Indexes
  • db.people.find({name: 'Jesse'}).explain()! {! ! "cursor" : "BasicCursor",! ! "n" : 10,! ! "nscanned" : 100000,! ! "millis" : 40,! }! ! db.people.createIndex({name: 1});! ! db.people.find({name: 'Jesse'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 10,! ! "nscanned" : 10,! ! "millis" : 0,! }! 1. Indexes
  • db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 10,! ! "millis" : 0,! }! ! db.people.createIndex({name: 1, hacks: 1});! ! db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 1,! ! "millis" : 0,! }! 1. Indexes
  • db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 10,! ! "millis" : 0,! }! ! db.people.createIndex({name: 1, hacks: 1});! ! db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 1,! ! "millis" : 0,! }! 1. Indexes
  • db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 10,! ! "millis" : 0,! }! ! db.people.createIndex({name: 1, hacks: 1});! ! db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 1,! ! "millis" : 0,! }! 1. Indexes
  • db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 10,! ! "millis" : 0,! }! ! db.people.createIndex({name: 1, hacks: 1});! ! db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1_hacks_1",! ! "n" : 1,! ! "nscanned" : 1,! ! "millis" : 0,! }! ! db.people.dropIndex({name: 1})! ! 1. Indexes
  • db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1",! ! "n" : 1,! ! "nscanned" : 10,! ! "millis" : 0,! }! ! db.people.createIndex({name: 1, hacks: 1});! ! db.people.find({name: 'Jesse', hacks: 'Python'}).explain()! {! ! "cursor" : "BtreeCursor name_1_hacks_1",! ! "n" : 1,! ! "nscanned" : 1,! ! "millis" : 0,! }! ! db.people.dropIndex({name: 1})! ! 1. Indexes
  • 2. File System • ext3 is bad
 • ext4 and xfs are good
  • • Set noatime
 • This goes in /etc/fstab 2. File System
  • 3. Working Set Size
  • 3. Working Set Size Disk! RAM!
  • 4. Disks
  • 4. Disks Option 1: Spinning disk. 100 seeks / sec
  • 4. Disks Option 2: Spinning disks!
  • ~100 seeks / second! ~100 seeks / second! ~100 seeks / second! ~100 seeks / second!
  • 4. Disks Option 3: SSD
  • 5. Shard
  • Primary! Secondary! Secondary! MongoS! Primary! Secondary! Secondary! Primary! Secondary! Secondary! Primary! Secondary! Secondary! 5. Shard
  • 1. Indexes 2. File System 3.Working Set 4. Disks 5. Shard
  • 1. Indexes 2. File System 3.Working Set 4. Disks 5. Shard The 5 Things You Need To Know About Scaling A. Jesse Jiryu Davis
 bit.ly/scaling-five