Permalink
Browse files

test insert some more complex objects

  • Loading branch information...
1 parent 25a26fc commit 622d9bee9c817731c483e231e639c3a161dfd0b5 dstrek committed Feb 16, 2013
Showing with 15 additions and 7 deletions.
  1. +15 −7 test/performance/db_smasher_pool.js
@@ -5,10 +5,13 @@ var logdebug = require('debug')('rdb:debug')
var logerror = require('debug')('rdb:error');
var draining = false;
+var max_cons = 200;
+var blocks = 5;
+var inserted = 0;
var connectionPool = pool.Pool({
name: 'rethinkdb',
- max : 100,
+ max : max_cons,
min : 1,
log : false,
idleTimeoutMillis : 1 * 60 * 1000,
@@ -57,26 +60,31 @@ function insert() {
function result(r) {
count++;
//console.log('inserted', r.generated_keys);
- if (count === 10) {
+ if (r.inserted) inserted++;
+ if (count >= blocks) {
connectionPool.release(con);
//turtles!
insert();
}
}
+ var arr = [];
+ var obj = {};
+ for (var x=0; x<50; x++) arr.push(Math.random());
+ for (var x=0; x<50; x++) obj[(r+Math.random().toString(36).substr(2,11))] = Math.random();
+ for (var x=0; x<blocks; x++) con.run(r.db('test').table('test').insert(obj), result);
- for (var x=0; x<10; x++) con.run(r.db('test').table('test').insert({val: 1}), result);
-
- if (connectionPool.getPoolSize() < 100 || connectionPool.availableObjectsCount()) {
+ if (connectionPool.getPoolSize() < max_cons || connectionPool.availableObjectsCount()) {
insert();
}
});
}
function stats() {
- console.log('pool size is', connectionPool.getPoolSize(), '/', connectionPool.availableObjectsCount());
+ console.log('pool size =', connectionPool.getPoolSize(), '/', connectionPool.availableObjectsCount() , 'inserted =', inserted);
+ inserted = 0;
}
-setInterval(stats, 2000);
+setInterval(stats, 1000);
insert();

0 comments on commit 622d9be

Please sign in to comment.