-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b644588
commit 519d2a0
Showing
11 changed files
with
935 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,30 @@ | ||
# MongoDB Performance Tuning Book | ||
|
||
This repository contains helper scripts and examples for the Apress book "MongoDB Performance Tuning". - https://www.apress.com/us/book/9781484268780 | ||
## Usage | ||
|
||
This repository contains helper scripts and examples for the Apress book "MongoDB Performance Tuning". - https://www.apress.com/us/book/9781484268780 | ||
|
||
The master script [mongoTuning.js](mongoTuning.js) provides access to all these scripts from within a MongoDB shell session. To use these scripts from within a MongoDB shell, simply issue the mongo command with the script name as an argument and add the '--shell' option, for example: | ||
|
||
The master script [mongoTuning.js](mongoTuning.js) provides access to all these scripts from within a MongoDB shell session. To use these scripts from within a MongoDB shell, simply issue the mongo command with the script name as an argument and add the '--shell' option, for example: | ||
``` | ||
$ mongo --shell mongoTuning.js | ||
MongoDB shell version v4.2.0 | ||
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb | ||
MongoDB server version: 4.2.0 | ||
rs0:PRIMARY> | ||
``` | ||
|
||
The examples can also be found in our GitHub repository under the [Examples](Examples) folder. The data that these examples use can be found in the [sampleData](sampleData) folder as a compressed dump file. Instructions on how to load the data can be found in the same folder. | ||
## Contents | ||
|
||
If you have any queries about this repository, please contact Guy at <[email protected]> or Mike at <[email protected]>. | ||
- [mongoTuning.js](mongoTuning.js) is a master script, compiling a number of helper functions into a single object that is used throughout the book. | ||
- The [examples](examples) folder contains some example scripts for using some of our helper functions along with output.. | ||
- The [sampleData](sampleData) directory contains all the data used in our examples as a compressed dump file. Instructions on how to load the data can be found in the same folder. | ||
- The scripts directory contains all the individual scripts which together create the master script(_mongoTuning.js_) along with some additional scripts that may not be used. | ||
- The [misc](misc) directory contains some files or data that is referenced in the book but not directly by the scripts, for example some sample alarms and metric calculations that readers may find userful. | ||
- [ExplainPlanSteps.md](ExplainPlanSteps.md) contains a breakdown of the various different stages you may encounter in an explain plan, along with a simple explanation of that stage. | ||
|
||
## Contact Us | ||
|
||
If you have any queries about this repository, please contact Guy at <[email protected]> or Mike at <[email protected]>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Example script which uses the Server Statistics sub-script to gather some performance data. | ||
* | ||
* @Authors: Michael Harrison ([email protected]) and Guy Harrison ([email protected]). | ||
* @Date: 2020-09-03T17:54:50+10:00 | ||
* @Last modified by: Michael Harrison | ||
* @Last modified time: 2021-04-08T10:49:07+10:00 | ||
* | ||
*/ | ||
load('../scripts/ServerStats.js'); | ||
var sample1 = mongoTuning.serverStatSample(); | ||
sleep(60000); | ||
var sample2 = mongoTuning.serverStatSample(); | ||
mongoTuning.serverStatSummary(sample1, sample2); | ||
var deltas = mongoTuning.serverStatDeltas(sample1, sample2); | ||
deltas['opcounters.query']; | ||
mongoTuning.serverStatSearch(deltas, /opLatencies.writes/); |
File renamed without changes.
Oops, something went wrong.