• Like

Five Things you Need to Know About Scaling

  • 462 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
462
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
33
Comments
1
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. The 5 Things You Need To Know About Scaling A. Jesse Jiryu Davis
 
 Senior Python Engineer
  • 2. 1. Indexes
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 2. File System • ext3 is bad
 • ext4 and xfs are good
  • 11. • Set noatime
 • This goes in /etc/fstab 2. File System
  • 12. 3. Working Set Size
  • 13. 3. Working Set Size Disk! RAM!
  • 14. 4. Disks
  • 15. 4. Disks Option 1: Spinning disk. 100 seeks / sec
  • 16. 4. Disks Option 2: Spinning disks!
  • 17. ~100 seeks / second! ~100 seeks / second! ~100 seeks / second! ~100 seeks / second!
  • 18. 4. Disks Option 3: SSD
  • 19. 5. Shard
  • 20. Primary! Secondary! Secondary! MongoS! Primary! Secondary! Secondary! Primary! Secondary! Secondary! Primary! Secondary! Secondary! 5. Shard
  • 21. 1. Indexes 2. File System 3.Working Set 4. Disks 5. Shard
  • 22. 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