Slide 1

Slide 1 text

Performance & Troubleshooting @kirilnyc @gcsports

Slide 2

Slide 2 text

• How MongoDB works (layman's version) • Common failure cases • Best practices

Slide 3

Slide 3 text

Fundamentals • OS Pager, LRU cache ejection • Working Set and implications • Documents on disk

Slide 4

Slide 4 text

Virtual Memory LRU

Slide 5

Slide 5 text

Working Set

Slide 6

Slide 6 text

Documents on Disk

Slide 7

Slide 7 text

Failing • Underestimating Working Set • Ill-Fitting Use Cases • Schema Design Mistakes

Slide 8

Slide 8 text

Oops, Overload

Slide 9

Slide 9 text

Estimating Working Set • Indexes • Core operational data (user records, etc) • Secondary records (logs, sessions) • Long tail data (historical, related) • Scans*

Slide 10

Slide 10 text

I Know, Let's use Mongo!

Slide 11

Slide 11 text

Sub-optimal Use Cases • Session storage • Big fragmented collections • Giant working sets + performance demands • Clearly tabular data

Slide 12

Slide 12 text

Simulated Joins!!!

Slide 13

Slide 13 text

Let's NoSQL! • Look for the largest granularity that works • Eschew lookup collections • Prefer containment over reference • Query sparingly

Slide 14

Slide 14 text

Best Practices • Denormalize heavily • Do Capacity Planning • Live in your slow query logs • Watch the numbers

Slide 15

Slide 15 text

Documents No thanks. Yes please.

Slide 16

Slide 16 text

Capacity Planning

Slide 17

Slide 17 text

Logs *yawn* Ruh-roh...

Slide 18

Slide 18 text

Numbers • Query load (subjective, learn yours) • Lock percentage (< 50%) • Queues (single digits) • Page faults (single digits)

Slide 19

Slide 19 text

@kirilnyc CTO, GameChanger Media http://GC.io/about