-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlong-mongo-perf.js
45 lines (39 loc) · 1.78 KB
/
long-mongo-perf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var possible = ["singledb","multidb","multicoll"];
var cond = {label:/daily-ee6fa9cf4870f81de1a4005cce2be6a91ac551ac-2014-12-06/};
db.long_exec.remove(cond);
db.raw.find(cond).forEach(
function(thisDoc) {
for (var k=0; k < possible.length; k++) {
var resType = possible[k];
if ( typeof thisDoc[resType] === "undefined" ) {
// print("skipping:" + thisDoc.label + " for:" + resType);
continue;
}
var dbConfig = thisDoc[resType]
for (var i=0; i < dbConfig.length; i++) {
var test = dbConfig[i];
for (var j=0; j < 48; j++) {
if ( typeof test.results[j] === "undefined" ) {
// print("skipping:" + thisDoc.label + " test:" + test.name + " it:" + j);
continue;
}
var diff = (test.results[j].run_end_time - test.results[j].run_start_time)/1000;
// Test to see if we exceed 105%
if ( diff > (test.results[j].elapsed_secs*1.05) ) {
res = { label: thisDoc.label,
test: test.name,
threads: j,
requested: test.results[j].elapsed_secs,
actual: diff,
percentage: (diff/test.results[j].elapsed_secs)*100 };
// printjson(res);
db.long_exec.insert(res);
}
}
}
}
}
)
db.long_exec.find(cond).sort({percentage:-1}).limit(20)
db.raw.find({label:/daily-ee6fa9cf4870f81de1a4005cce2be6a91ac551ac-2014-12-06/},{label:1,run_time:1,end_time:1,_id:0}).forEach( function (d) { print(d.label + ":" + ((d.end_time - d.run_time)/60000));})
db.raw.find({},{label:1,server_storage_engine:1}).forEach( function (d) { if (d.label.indexOf(d.server_storage_engine) == -1) {print(d.label+"/"+d.server_storage_engine);}})