incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Monteiro <ma...@textovirtual.com>
Subject Re: CouchDB freezes
Date Sat, 12 May 2012 02:30:24 GMT
I tried to run this code on 3 different machines, all with the same version
of node (0.6.17)and couchdb (1.2). On one of them, connections are reused
(the "Connection: keep-alive" http header is respected); on the other two,
one connection is created for each requests. Anyone has any idea of why
this might be happening?

Thanks,
Marco


On 11 May 2012 16:12, Robert Newson <rnewson@apache.org> wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message