diff options
author | Yuhong Zhang <danielzhangyh@gmail.com> | 2020-07-13 18:06:32 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-14 18:11:10 +0000 |
commit | 526878fe931d0042000a94377501c89b403c43be (patch) | |
tree | 73f4091100e2f5d682d00d0cdf6128be8bffa8ce | |
parent | a3d23a225219e3390879a816de36a2fea95a8e48 (diff) | |
download | mongo-526878fe931d0042000a94377501c89b403c43be.tar.gz |
SERVER-49008 Create a new jstest to track Biggie's metrics
-rw-r--r-- | jstests/noPassthroughWithMongod/biggie_memory_metrics.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/jstests/noPassthroughWithMongod/biggie_memory_metrics.js b/jstests/noPassthroughWithMongod/biggie_memory_metrics.js new file mode 100644 index 00000000000..9ee0caddb93 --- /dev/null +++ b/jstests/noPassthroughWithMongod/biggie_memory_metrics.js @@ -0,0 +1,58 @@ +/** + * Tracks Biggie's memory usage metrics on a consistent workload. + * TODO SERVER-36709: Making the nodes adaptive should improve the memory usage retrieved here. + */ +(function() { +"use strict"; + +const storageEngine = jsTest.options().storageEngine; +if (storageEngine != "biggie") { + // TODO SERVER-38987: Replace this with "ephemeralForTest". + return; +} + +let testColl1 = db.jstests_ephemeralForTest_metrics1; +let testColl2 = db.jstests_ephemeralForTest_metrics2; +let testColl3 = db.jstests_ephemeralForTest_metrics3; + +const s1 = startParallelShell(() => { + testColl1 = db.jstests_ephemeralForTest_metrics1; + for (let i = 0; i < 50000; ++i) { + assert.writeOK(testColl1.save({x: Math.floor(Math.random() * 1024 * 1024), y: "y"})); + } + assert.commandWorked(testColl1.createIndex({x: 1, y: 1})); + for (let i = 0; i < 50000; ++i) { + assert.writeOK(testColl1.save({x: Math.floor(Math.random() * 1024 * 1024), y: "y"})); + } +}); + +const s2 = startParallelShell(function() { + testColl2 = db.jstests_ephemeralForTest_metrics2; + for (let i = 0; i < 50000; ++i) { + assert.writeOK(testColl2.save({x: "x", y: Math.floor(Math.random() * 1024 * 1024)})); + } + + for (let i = 0; i < 100; ++i) { + assert.commandWorked( + testColl2.updateOne({x: "x"}, {$set: {x: Math.floor(Math.random() * 1024 * 1024)}})); + } +}); + +const s3 = startParallelShell(function() { + testColl3 = db.jstests_ephemeralForTest_metrics3; + for (let i = 0; i < 50000; ++i) { + assert.writeOK(testColl3.save({ + x: Math.floor(Math.random() * 1024 * 1024), + y: Math.floor(Math.random() * 1024 * 1024) + })); + } +}); + +s1(); +s2(); +s3(); + +const serverStatus = db.serverStatus().biggie; +print("Total Memory Usage: " + serverStatus.totalMemoryUsage + " Bytes."); +print("Total Number of Nodes: " + serverStatus.totalNodes + "."); +})();
\ No newline at end of file |