Skip to content

Commit

Permalink
Cleanup of repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljharrison committed Apr 8, 2021
1 parent b644588 commit 519d2a0
Show file tree
Hide file tree
Showing 11 changed files with 935 additions and 43 deletions.
20 changes: 15 additions & 5 deletions README.md
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]>.
17 changes: 17 additions & 0 deletions examples/Example_ServerStats.js
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.
Loading

0 comments on commit 519d2a0

Please sign in to comment.