var collName = 'topchunk';
|
var st = new ShardingTest({ shards: 2, other: {
|
shardOptions: { storageEngine: "wiredTiger"}, nopreallocj: 1 }
|
});
|
var testDB = st.s.getDB('test');
|
var coll = testDB[collName];
|
coll.drop();
|
testDB.adminCommand({ enableSharding: 'test' });
|
testDB.adminCommand({ shardCollection: coll.getFullName(), key: { _id: 1 }});
|
coll.createIndex({t:1}, {expireAfterSeconds: 10*60});
|
st.startBalancer();
|
var mongos = st.s;
|
|
var threads = 4;
|
var time = 10;
|
var batchSize = 1000;
|
|
var docs = []
|
var longString = new Array().join(" ");
|
for (var i = 0; i < batchSize; i++) {
|
docs.push( {x: longString, ttl: {"#CUR_DATE": 0}} );
|
}
|
|
function testInsert(docs, threads, time) {
|
var benchArgs = { ops : [ { ns : coll.getFullName() ,
|
op : "insert" ,
|
doc : docs} ],
|
parallel : threads,
|
seconds : time,
|
totals : true ,
|
host : mongos.host}
|
res = benchRun(benchArgs);
|
return res;
|
}
|
|
// insert a bunch of documents and track ops/sec
|
while(1) {
|
var result = testInsert(docs, threads, time);
|
printjson(result);
|
}
|