Slide 1

Slide 1 text

MongoDB: Best Practices, Performance Tricks, .NET Tips & Tricks

Slide 2

Slide 2 text

SELÇUK USTA Sr. Engineering Manager /in/selcukusta selcukusta.com selcukusta ustasoglu selcukusta (at)gmail.com

Slide 3

Slide 3 text

AGENDA > MongoDB - Design Patterns > What should be observed? > How can be observed? > Index Optimization & Best Practices > MongoDB on .NET

Slide 4

Slide 4 text

Design Patterns Database!?! Design Patterns?!? wtf!?!

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Design Patterns Database!?! Design Patterns?!? wtf!?! Bloated Attribute Subset Document Versioning etc… Polymorphic

Slide 7

Slide 7 text

Design Patterns Database!?! Design Patterns?!? wtf!?! WHY is it so IMPORTANT?

Slide 8

Slide 8 text

WORKING SET most frequently accessed documents by clients + all indexes should fit into the RAM! (RAM - 1) * 0,5 or 256 MB WIREDTIGER STORAGE ENGINE

Slide 9

Slide 9 text

needs to check periodically; > db.serverStatus().wiredTiger.cache[...] > db.stats().dataSize > db.stats().indexSize > mongostat --uri="" --interactive --discover -o="COLUMN_1,COLUMN_2" WIREDTIGER STORAGE ENGINE WORKING SET (RAM - 1) * 0,5 or 256 MB

Slide 10

Slide 10 text

WORKING SET (RAM - 1) * 0,5 or 256 MB

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Concurrency Ticket & Queue Max 128 Concurrent Read #qr Max 128 Concurrent Write #qw

Slide 13

Slide 13 text

MONGODB INDEXING OPTIMIZATION Range Equality Sort Selectivity Index Stats ExecutionStats Compound Cardinality B-Tree

Slide 14

Slide 14 text

TIPS TRICKS

Slide 15

Slide 15 text

use “appName” in your connection options Tips and Tricks

Slide 16

Slide 16 text

consider using an individual read preference setting instead of the one provided by connection settings Tips and Tricks

Slide 17

Slide 17 text

do not forget to use “maxTimeMS()” to avoid blocking concurrent operations Tips and Tricks

Slide 18

Slide 18 text

fine-tune “connection pooling” mechanism in order for both database and applications to perform expected Tips and Tricks

Slide 19

Slide 19 text

THANK YOU! /in/selcukusta selcukusta.com selcukusta ustasoglu selcukusta (at)gmail.com