SlideShare a Scribd company logo
1 of 41
Download to read offline
Advanced MongoDB
for Development, Deployment and
Operation - The Sequel
Daniel Coupal
Technical Services Engineer, Palo Alto, CA
#MongoDB
Silicon Valley Code Camp 2015
2
• Making you successful in developing,
deploying and operating an application with
MongoDB
• I do expect you to know the basics of
MongoDB.
• …even better if you already have an
application about to be deployed or
deployed
This presentation is about …
3
I hope you walk out of this presentation and
you make at least one single change in your
application, deployment, configuration, etc
that will prevent one issue from happening.
My Goal
4
1.  The Story of MongoDB
2.  The Story of your Application
Chapter 1: Prototype and Development
Chapter 2: Deployment
Chapter 3: Operation
3.  Wrapping up
4.  Q&A
Agenda
1. The Story of MongoDB
6
The Sun was shinning on the land of the Oracle …
Once upon a time
7
Then came the Web
8
We’re gonna need a bigger database
9
•  Originaly, 10gen
– Founded in 2007
– Released MongoDB 1.0 in 2009
•  MongoDB Inc
– Since 2013
– Acquired WiredTiger in 2014
•  MongoDB
– Open source software
– Contributions on tools, drivers, …
– Most popular NoSQL database
MongoDB - Timeline
10
MongoDB - Company Overview
450+ employees 1,000+ customers
Over $300 million in funding30+ offices around the world
11
Positions open in Palo Alto, Austin and NYC
• http://www.mongodb.com/careers/positions
Technical service engineers in Palo Alto
• MongoDB
• MongoDB Tools
• Proactive support
MongoDB - We hire!
2. The Story of your Application
13
1.  Schema, schema, schema!
2.  Incorporate testability in your application
3.  Think about data sizing and growth
4.  What happens when a failure is returned
by the database?
5.  Index correctly
6.  Performance Tuning
Chapter 1 - Prototype and Development
14
•  Relational world
1.  Model your data
2.  Write the application against your data
•  NoSQL world
1.  Define what you do want to do with the data
Ø What are your queries?
2.  Model your data
Schema, schema, schema
15
•  Test Driven Development
•  Ask yourself, how can I test that this piece is
working
•  TIP: MongoDB does not need a schema and it
creates databases and collections (tables) on the
fly
– Incorporate username, hostname, timestamps in
database names for unit tests
Incorporate testability in the application
16
•  How much data will you have initially?
•  How will your data set grow over time?
•  How big is your working set?
•  Will you be loading huge bulk inserts, or have a
constant stream of writes?
•  How many reads and writes will you need to
service per second?
•  What is the peak load you need to provision for?
Think about data sizing and growth
17
•  Good model and understanding of latencies, write
concerns
•  Catch exceptions
•  Retries
•  …
What happens when a failure is returned
by the database?
18
•  More than 50% of the customer issues
•  Collection Scan
– Very bad if you have a large collection
– One of the main performance issue see in our
customers’ application
– Can be identified in the logs with the
‘nscannedObjects’ attribute on slow queries
•  Watch out for updates to the Application
Index correctly
19
1.  Assess the problem and establish acceptable behavior
2.  Measure the current performance
3.  Find the bottleneck*
4.  Remove the bottleneck
5.  Re-test to confirm
6.  Repeat
* - (This is often the hard part)
(Adapted from http://en.wikipedia.org/wiki/Performance_tuning )
Performance Tuning
20
1.  Deployment topology
2.  Have a test/staging environment
– Track slow queries and collection scans
3.  MongoDB production notes
–  http://docs.mongodb.org/manual/administration/production-notes
4.  Storage considerations
5.  Host considerations
Chapter 2 - Deploy
21
•  Sharding or not?
•  3 data nodes per replica set or 2 data nodes + arbiter?
•  Many Data Centers or availability zones
•  What is important for you?
– Durability of writes
– Performance
=> can be chosen per operation
Deployment topology
22
•  Best if it the capacity matches the production deployment
–  Otherwise, if prod is 20 shards x 3 nodes, you can have 2 x 3
nodes, or 20 x 1 node
•  Data size should be representative
–  Start with simulated data
–  Use backup of production data
•  Disable table/collection scans or scan the logs for them
Have a test/staging environment
23
•  Most important documentation of MongoDB
–  http://docs.mongodb.org/v3.0/administration/production-notes/
•  Security checklist
–  Authentication, limit network exposure, … audit system activity
•  Allocate Sufficient RAM and CPU
•  MongoDB and NUMA Hardware
•  Platform Specific Considerations
–  Turn off atime for the storage volume containing the database files.
–  Set the file descriptor limit, -n, and the user process limit (ulimit), -u,
above 20,000
–  MongoDB on Virtual Environments
MongoDB Production notes
24
•  RAID
=> 0+1 or None
•  HDD or SSD
=> SSD, if budget permit
•  NAS, SAN or Direct Attached?
=> Direct Attached, good news those are the cheapest!
•  File System type
MMAPv1 => ext4
WiredTiger => xfs
•  Settings
=> ReadAhead
Storage considerations
25
• CPU power?
– MMAPv1 => no
– WiredTiger => yes, needed for compression
• RAM?
– Yes! RAM is always an order of magnitude faster than
disk
Host considerations
26
1.  Monitor
2.  Upgrade
3.  Backup
4.  Troubleshoot
Chapter 3 - Operation
27
“Shit will happen!”
• Are you prepared?
• Have backups?
• Have a good picture of your “normal state”
Disaster will strike
28
• iostat, top, vmstat, sar
• mongostat, mongotop
• CloudManager/OpsManager Monitoring
– plus Munin extensions
Monitor
29
• Major versions have same binary format,
same protocol, etc for each new minor
version
• Major versions have upgrade and
downgrade paths
• CloudManager and OpsManager Automation
handles automatic upgrades
Upgrade
30
Mongodump File system CloudManager
Backup
OpsManager
Backup
Initial complexity Medium High Low High
System overhead High Low Low Medium
Point in time
recovery of replica
set
No * No * Yes Yes
Consistent
snapshot of
sharded system
No * No * Yes Yes
Scalable No Yes Yes Yes
Restore time Slow Fast Medium Medium
Comparing MongoDB backup approaches
* Possible, but need to write the tools and go though a lot of testing
31
• mtools
– https://github.com/rueckstiess/mtools/wiki
(just Google: github mtools)
Troubleshoot
32
namespace pattern count min (ms) max (ms) mean (ms) sum (ms)
serverside.scrum_master {"datetime_used": {"$ne": 1}} 20 15753 17083 16434 328692
serverside.django_session {"_id": 1} 562 101 1512 317 178168
serverside.user {"_types": 1, "emails.email": 1} 804 101 1262 201 162311
local.slaves {"_id": 1, "host": 1, "ns": 1} 131 101 1048 310 40738
serverside.email_alerts {"_types": 1, "email": 1, "pp_user_id": 1} 13 153 11639 2465 32053
serverside.sign_up {"_id": 1} 77 103 843 269 20761
serverside.user_credits {"_id": 1} 6 204 900 369 2218
serverside.counters {"_id": 1, "_types": 1} 8 121 500 263 2111
serverside.auth_sessions {"session_key": 1} 7 111 684 277 1940
serverside.credit_card {"_id": 1} 5 145 764 368 1840
serverside.email_alerts {"_types": 1, "request_code": 1} 6 143 459 277 1663
serverside.user {"_id": 1, "_types": 1} 5 153 427 320 1601
serverside.user {"emails.email": 1} 2 218 422 320 640
serverside.user {"_id": 1} 2 139 278 208 417
serverside.auth_sessions {"session_endtime": 1, "session_userid": 1} 1 244 244 244 244
serverside.game_level {"_id": 1} 1 104 104 104 104
Troubleshoot – Slow Queries
33
• Interactive graph!
Troubleshoot – Slow Queries Plot
3. Wrapping up
35
1.  Missing indexes
2.  Not testing before deploying application changes
3.  OS settings
4.  Appropriate schema
5.  Hardware
6.  Not seeking help early enough
Common Mistakes
36
•  MongoDB on-line presentations mongodb.com/presentations
•  Free MongoDB classes university.mongodb.com
•  mtools to analyze MongoDB logs github.com/rueckstiess/mtools
•  CloudManager cloud.mongodb.com
Free On-Line Resources
37
•  MongoDB Support
– 24x7 support
– the sun never set on MongoDB Customer Support Team
•  MongoDB Consulting Days
•  MongoDB World (@NYC on June 28-29, 2016)
•  MongoDB Days (@SanJose on Dec 3, 2015)
Resources
38
• Use available resources
• Testing
– Plan for it, plan resources for it, do it before deploying
in a Test or Staging environment
Summary
39
I hope you walk out of this presentation and
you make at least one single change in your
application, deployment, configuration, etc
that will prevent one issue from happening.
Take away
4. Q&A
41
Positions open in Palo Alto, Austin and NYC
•  http://www.mongodb.com/careers
MongoDB for Giant Ideas

More Related Content

What's hot

SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization ChecklistGrant Fritchey
 
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbeganKoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbeganTobias Koprowski
 
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorldSQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorldPolish SQL Server User Group
 
Performance Tuning
Performance TuningPerformance Tuning
Performance TuningJannet Peetz
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondMind The Firebird
 
Oracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known FeaturesOracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known FeaturesTanel Poder
 
Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...
Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...
Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...PostgreSQL-Consulting
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014Enkitec
 
Oracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big DataOracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big DataAbishek V S
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimizationManish Rawat
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyAntonios Chatzipavlis
 
Windows 7 Feature Overview It Academic Day 2009
Windows 7 Feature Overview   It Academic Day 2009Windows 7 Feature Overview   It Academic Day 2009
Windows 7 Feature Overview It Academic Day 2009Tobias Koprowski
 
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLAKoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLATobias Koprowski
 
XPages on Bluemix - the Do's and Dont's
XPages on Bluemix - the Do's and Dont'sXPages on Bluemix - the Do's and Dont's
XPages on Bluemix - the Do's and Dont'sOliver Busse
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...rschuppe
 
Barcelona mysqlnd qc
Barcelona mysqlnd qcBarcelona mysqlnd qc
Barcelona mysqlnd qcAnis Berejeb
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceMark Ginnebaugh
 
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYCScalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYCCal Henderson
 

What's hot (20)

SQL Server Optimization Checklist
SQL Server Optimization ChecklistSQL Server Optimization Checklist
SQL Server Optimization Checklist
 
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbeganKoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
KoprowskiT_SQLSat219_Kiev_2AM-aDisasterJustbegan
 
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorldSQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
SQLDay2013_Denny Cherry - SQLServer2012inaHighlyAvailableWorld
 
Performance Tuning
Performance TuningPerformance Tuning
Performance Tuning
 
Threading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyondThreading through InterBase, Firebird, and beyond
Threading through InterBase, Firebird, and beyond
 
Five steps perform_2013
Five steps perform_2013Five steps perform_2013
Five steps perform_2013
 
Oracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known FeaturesOracle Exadata Performance: Latest Improvements and Less Known Features
Oracle Exadata Performance: Latest Improvements and Less Known Features
 
Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...
Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...
Linux IO internals for database administrators (SCaLE 2017 and PGDay Nordic 2...
 
Fatkulin hotsos 2014
Fatkulin hotsos 2014Fatkulin hotsos 2014
Fatkulin hotsos 2014
 
Performance tuning in sql server
Performance tuning in sql serverPerformance tuning in sql server
Performance tuning in sql server
 
Oracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big DataOracle Database 12c - Features for Big Data
Oracle Database 12c - Features for Big Data
 
Sql server performance tuning and optimization
Sql server performance tuning and optimizationSql server performance tuning and optimization
Sql server performance tuning and optimization
 
Pre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctlyPre and post tips to installing sql server correctly
Pre and post tips to installing sql server correctly
 
Windows 7 Feature Overview It Academic Day 2009
Windows 7 Feature Overview   It Academic Day 2009Windows 7 Feature Overview   It Academic Day 2009
Windows 7 Feature Overview It Academic Day 2009
 
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLAKoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
 
XPages on Bluemix - the Do's and Dont's
XPages on Bluemix - the Do's and Dont'sXPages on Bluemix - the Do's and Dont's
XPages on Bluemix - the Do's and Dont's
 
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
Application Performance Troubleshooting 1x1 - Part 2 - Noch mehr Schweine und...
 
Barcelona mysqlnd qc
Barcelona mysqlnd qcBarcelona mysqlnd qc
Barcelona mysqlnd qc
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
 
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYCScalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
Scalable Web Architectures: Common Patterns and Approaches - Web 2.0 Expo NYC
 

Similar to Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel

Silicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDBSilicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDBDaniel Coupal
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Databricks
 
Hardware Provisioning
Hardware ProvisioningHardware Provisioning
Hardware ProvisioningMongoDB
 
Silicon Valley Code Camp 2016 - MongoDB in production
Silicon Valley Code Camp 2016 - MongoDB in productionSilicon Valley Code Camp 2016 - MongoDB in production
Silicon Valley Code Camp 2016 - MongoDB in productionDaniel Coupal
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019Dave Stokes
 
Benchmarking at Parse
Benchmarking at ParseBenchmarking at Parse
Benchmarking at ParseTravis Redman
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at ParseMongoDB
 
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLPerformance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLTriNimbus
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSPC Adriatics
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACPerformance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACKristofferson A
 
MongoDB: How We Did It – Reanimating Identity at AOL
MongoDB: How We Did It – Reanimating Identity at AOLMongoDB: How We Did It – Reanimating Identity at AOL
MongoDB: How We Did It – Reanimating Identity at AOLMongoDB
 
Open source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packagesOpen source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packagesRogue Wave Software
 
Back to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production DeploymentBack to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production DeploymentMongoDB
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big timeproitconsult
 
Cognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksCognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksSenturus
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014Ryusuke Kajiyama
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesJonathan Klein
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502kaziul Islam Bulbul
 
Webinar: Best Practices for Upgrading to MongoDB 3.2
Webinar: Best Practices for Upgrading to MongoDB 3.2Webinar: Best Practices for Upgrading to MongoDB 3.2
Webinar: Best Practices for Upgrading to MongoDB 3.2Dana Elisabeth Groce
 

Similar to Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel (20)

Silicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDBSilicon Valley Code Camp 2014 - Advanced MongoDB
Silicon Valley Code Camp 2014 - Advanced MongoDB
 
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
Lessons Learned Replatforming A Large Machine Learning Application To Apache ...
 
Hardware Provisioning
Hardware ProvisioningHardware Provisioning
Hardware Provisioning
 
Silicon Valley Code Camp 2016 - MongoDB in production
Silicon Valley Code Camp 2016 - MongoDB in productionSilicon Valley Code Camp 2016 - MongoDB in production
Silicon Valley Code Camp 2016 - MongoDB in production
 
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 20197 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
7 Database Mistakes YOU Are Making -- Linuxfest Northwest 2019
 
Benchmarking at Parse
Benchmarking at ParseBenchmarking at Parse
Benchmarking at Parse
 
Advanced Benchmarking at Parse
Advanced Benchmarking at ParseAdvanced Benchmarking at Parse
Advanced Benchmarking at Parse
 
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACLPerformance Optimization of Cloud Based Applications by Peter Smith, ACL
Performance Optimization of Cloud Based Applications by Peter Smith, ACL
 
SharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi VončinaSharePoint 2013 Performance Analysis - Robi Vončina
SharePoint 2013 Performance Analysis - Robi Vončina
 
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RACPerformance Scenario: Diagnosing and resolving sudden slow down on two node RAC
Performance Scenario: Diagnosing and resolving sudden slow down on two node RAC
 
MongoDB: How We Did It – Reanimating Identity at AOL
MongoDB: How We Did It – Reanimating Identity at AOLMongoDB: How We Did It – Reanimating Identity at AOL
MongoDB: How We Did It – Reanimating Identity at AOL
 
Open source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packagesOpen source: Top issues in the top enterprise packages
Open source: Top issues in the top enterprise packages
 
Back to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production DeploymentBack to Basics Webinar 6: Production Deployment
Back to Basics Webinar 6: Production Deployment
 
Scaling apps for the big time
Scaling apps for the big timeScaling apps for the big time
Scaling apps for the big time
 
Cognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & TricksCognos Performance Tuning Tips & Tricks
Cognos Performance Tuning Tips & Tricks
 
MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014MySQL Performance Tuning at COSCUP 2014
MySQL Performance Tuning at COSCUP 2014
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
 
Webinar: Best Practices for Upgrading to MongoDB 3.2
Webinar: Best Practices for Upgrading to MongoDB 3.2Webinar: Best Practices for Upgrading to MongoDB 3.2
Webinar: Best Practices for Upgrading to MongoDB 3.2
 
Breaking data
Breaking dataBreaking data
Breaking data
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Silicon Valley Code Camp 2015 - Advanced MongoDB - The Sequel

  • 1. Advanced MongoDB for Development, Deployment and Operation - The Sequel Daniel Coupal Technical Services Engineer, Palo Alto, CA #MongoDB Silicon Valley Code Camp 2015
  • 2. 2 • Making you successful in developing, deploying and operating an application with MongoDB • I do expect you to know the basics of MongoDB. • …even better if you already have an application about to be deployed or deployed This presentation is about …
  • 3. 3 I hope you walk out of this presentation and you make at least one single change in your application, deployment, configuration, etc that will prevent one issue from happening. My Goal
  • 4. 4 1.  The Story of MongoDB 2.  The Story of your Application Chapter 1: Prototype and Development Chapter 2: Deployment Chapter 3: Operation 3.  Wrapping up 4.  Q&A Agenda
  • 5. 1. The Story of MongoDB
  • 6. 6 The Sun was shinning on the land of the Oracle … Once upon a time
  • 8. 8 We’re gonna need a bigger database
  • 9. 9 •  Originaly, 10gen – Founded in 2007 – Released MongoDB 1.0 in 2009 •  MongoDB Inc – Since 2013 – Acquired WiredTiger in 2014 •  MongoDB – Open source software – Contributions on tools, drivers, … – Most popular NoSQL database MongoDB - Timeline
  • 10. 10 MongoDB - Company Overview 450+ employees 1,000+ customers Over $300 million in funding30+ offices around the world
  • 11. 11 Positions open in Palo Alto, Austin and NYC • http://www.mongodb.com/careers/positions Technical service engineers in Palo Alto • MongoDB • MongoDB Tools • Proactive support MongoDB - We hire!
  • 12. 2. The Story of your Application
  • 13. 13 1.  Schema, schema, schema! 2.  Incorporate testability in your application 3.  Think about data sizing and growth 4.  What happens when a failure is returned by the database? 5.  Index correctly 6.  Performance Tuning Chapter 1 - Prototype and Development
  • 14. 14 •  Relational world 1.  Model your data 2.  Write the application against your data •  NoSQL world 1.  Define what you do want to do with the data Ø What are your queries? 2.  Model your data Schema, schema, schema
  • 15. 15 •  Test Driven Development •  Ask yourself, how can I test that this piece is working •  TIP: MongoDB does not need a schema and it creates databases and collections (tables) on the fly – Incorporate username, hostname, timestamps in database names for unit tests Incorporate testability in the application
  • 16. 16 •  How much data will you have initially? •  How will your data set grow over time? •  How big is your working set? •  Will you be loading huge bulk inserts, or have a constant stream of writes? •  How many reads and writes will you need to service per second? •  What is the peak load you need to provision for? Think about data sizing and growth
  • 17. 17 •  Good model and understanding of latencies, write concerns •  Catch exceptions •  Retries •  … What happens when a failure is returned by the database?
  • 18. 18 •  More than 50% of the customer issues •  Collection Scan – Very bad if you have a large collection – One of the main performance issue see in our customers’ application – Can be identified in the logs with the ‘nscannedObjects’ attribute on slow queries •  Watch out for updates to the Application Index correctly
  • 19. 19 1.  Assess the problem and establish acceptable behavior 2.  Measure the current performance 3.  Find the bottleneck* 4.  Remove the bottleneck 5.  Re-test to confirm 6.  Repeat * - (This is often the hard part) (Adapted from http://en.wikipedia.org/wiki/Performance_tuning ) Performance Tuning
  • 20. 20 1.  Deployment topology 2.  Have a test/staging environment – Track slow queries and collection scans 3.  MongoDB production notes –  http://docs.mongodb.org/manual/administration/production-notes 4.  Storage considerations 5.  Host considerations Chapter 2 - Deploy
  • 21. 21 •  Sharding or not? •  3 data nodes per replica set or 2 data nodes + arbiter? •  Many Data Centers or availability zones •  What is important for you? – Durability of writes – Performance => can be chosen per operation Deployment topology
  • 22. 22 •  Best if it the capacity matches the production deployment –  Otherwise, if prod is 20 shards x 3 nodes, you can have 2 x 3 nodes, or 20 x 1 node •  Data size should be representative –  Start with simulated data –  Use backup of production data •  Disable table/collection scans or scan the logs for them Have a test/staging environment
  • 23. 23 •  Most important documentation of MongoDB –  http://docs.mongodb.org/v3.0/administration/production-notes/ •  Security checklist –  Authentication, limit network exposure, … audit system activity •  Allocate Sufficient RAM and CPU •  MongoDB and NUMA Hardware •  Platform Specific Considerations –  Turn off atime for the storage volume containing the database files. –  Set the file descriptor limit, -n, and the user process limit (ulimit), -u, above 20,000 –  MongoDB on Virtual Environments MongoDB Production notes
  • 24. 24 •  RAID => 0+1 or None •  HDD or SSD => SSD, if budget permit •  NAS, SAN or Direct Attached? => Direct Attached, good news those are the cheapest! •  File System type MMAPv1 => ext4 WiredTiger => xfs •  Settings => ReadAhead Storage considerations
  • 25. 25 • CPU power? – MMAPv1 => no – WiredTiger => yes, needed for compression • RAM? – Yes! RAM is always an order of magnitude faster than disk Host considerations
  • 26. 26 1.  Monitor 2.  Upgrade 3.  Backup 4.  Troubleshoot Chapter 3 - Operation
  • 27. 27 “Shit will happen!” • Are you prepared? • Have backups? • Have a good picture of your “normal state” Disaster will strike
  • 28. 28 • iostat, top, vmstat, sar • mongostat, mongotop • CloudManager/OpsManager Monitoring – plus Munin extensions Monitor
  • 29. 29 • Major versions have same binary format, same protocol, etc for each new minor version • Major versions have upgrade and downgrade paths • CloudManager and OpsManager Automation handles automatic upgrades Upgrade
  • 30. 30 Mongodump File system CloudManager Backup OpsManager Backup Initial complexity Medium High Low High System overhead High Low Low Medium Point in time recovery of replica set No * No * Yes Yes Consistent snapshot of sharded system No * No * Yes Yes Scalable No Yes Yes Yes Restore time Slow Fast Medium Medium Comparing MongoDB backup approaches * Possible, but need to write the tools and go though a lot of testing
  • 32. 32 namespace pattern count min (ms) max (ms) mean (ms) sum (ms) serverside.scrum_master {"datetime_used": {"$ne": 1}} 20 15753 17083 16434 328692 serverside.django_session {"_id": 1} 562 101 1512 317 178168 serverside.user {"_types": 1, "emails.email": 1} 804 101 1262 201 162311 local.slaves {"_id": 1, "host": 1, "ns": 1} 131 101 1048 310 40738 serverside.email_alerts {"_types": 1, "email": 1, "pp_user_id": 1} 13 153 11639 2465 32053 serverside.sign_up {"_id": 1} 77 103 843 269 20761 serverside.user_credits {"_id": 1} 6 204 900 369 2218 serverside.counters {"_id": 1, "_types": 1} 8 121 500 263 2111 serverside.auth_sessions {"session_key": 1} 7 111 684 277 1940 serverside.credit_card {"_id": 1} 5 145 764 368 1840 serverside.email_alerts {"_types": 1, "request_code": 1} 6 143 459 277 1663 serverside.user {"_id": 1, "_types": 1} 5 153 427 320 1601 serverside.user {"emails.email": 1} 2 218 422 320 640 serverside.user {"_id": 1} 2 139 278 208 417 serverside.auth_sessions {"session_endtime": 1, "session_userid": 1} 1 244 244 244 244 serverside.game_level {"_id": 1} 1 104 104 104 104 Troubleshoot – Slow Queries
  • 35. 35 1.  Missing indexes 2.  Not testing before deploying application changes 3.  OS settings 4.  Appropriate schema 5.  Hardware 6.  Not seeking help early enough Common Mistakes
  • 36. 36 •  MongoDB on-line presentations mongodb.com/presentations •  Free MongoDB classes university.mongodb.com •  mtools to analyze MongoDB logs github.com/rueckstiess/mtools •  CloudManager cloud.mongodb.com Free On-Line Resources
  • 37. 37 •  MongoDB Support – 24x7 support – the sun never set on MongoDB Customer Support Team •  MongoDB Consulting Days •  MongoDB World (@NYC on June 28-29, 2016) •  MongoDB Days (@SanJose on Dec 3, 2015) Resources
  • 38. 38 • Use available resources • Testing – Plan for it, plan resources for it, do it before deploying in a Test or Staging environment Summary
  • 39. 39 I hope you walk out of this presentation and you make at least one single change in your application, deployment, configuration, etc that will prevent one issue from happening. Take away
  • 41. 41 Positions open in Palo Alto, Austin and NYC •  http://www.mongodb.com/careers MongoDB for Giant Ideas