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 Sat, 12 May 2012 12:34:55 GMT
It's a bit obvious, but I'd suspect node. HTTP 1.1 connections are
supposed to have 'keep-alive' semantics by default (you have to
explicitly say 'Connection: close' to get the old 1.0 behavior). The
http module in node has never honored that, instead requiring an
explicit 'Connection: keep-alive'. I have looked at node in a year or
more, perhaps this has all changed for the better.

Check that you're using the same version of all your other node
modules (especially nodeload), perhaps one of them is different
between your machines and is preventing the keep-alive setting from
getting all the way down the client object.

B.

On 12 May 2012 03:30, Marco Monteiro <marco@textovirtual.com> wrote:
> 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
View raw message