incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: CouchDB freezes
Date Fri, 11 May 2012 15:12:13 GMT
Try this, I'm getting about 420 rps on my Air;

#!/usr/bin/env node
var nl = require('nodeload');

function newID () {
    return Date.now() + "-" + guid();
}

function guid() {
    return (S4()+S4()+S4()+S4());
    function S4 () {
        return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
    };
};

var loadtest = nl.run({
    name: "Insert Test",
    host: 'localhost',
    port: 5984,
    timeLimit: 60,
    targetRps: 500,
    stats: ['latency', 'result-codes', 'concurrency',
            {name: 'http-errors',successCodes: [201],log: 'http-errors.log'}],
    requestGenerator: function(client) {
        var newId = newID();
        var id = guid();
        var body = JSON.stringify({
            _id: newId,
            sid: id,
            pid: id,
            time: Date.now(),
            ua: "test",
            ua_str:
"asdkcasjkdnckasdlcasndlcknasdlkcasldcnaklsdnclasjkdnclaksdnclkansdcjklasndlckjandc",

            type: "adlkfmaasdcslkdmf",

            data: { str:
"asdkcasjkdnckasdlcasndlcknasdlkcasldcnaklsdnclasjkdnclaksdnclkansdcjklasndlckjandc"
},
            page: "maisumastring",
            uid: id,

            ip: "127.0.0.1",

            id: id,

            page_type: "asdfklandklafnsldkfn",
            referrer:
"asdkcasjkdnckasdlcasndlcknasdlkcasldcnaklsdnclasjkdnclaksdnclkansdcjklasndlckjandc",
            width: 1000,
            height: 1000
        })

        var headers = {
            'Content-Type': 'application/json',
            'Content-Length': body.length
            ,'Connection':'keep-alive'
        };
        var db = '/db1';
        var post = client.request('POST', db, headers);
        post.write(body);
        return post;
    }
});
loadtest.on('end', function() { console.log('Load test done.'); });

Mime
View raw message