Hm, it should be sufficient to include the header, I remember that getting fixed a long time ago.
I should have mentioned ephemeral port exhaustion as a possibility, sorry! B. On 11 May 2012 20:57, Marco Monteiro <ma...@textovirtual.com> wrote: > Thanks, Robert. > > The script worked as expected. > > The problem is that the I'm running out of tcp ports. I'm passing > "Connection: keep-alive" but nodejs is ignoring that, I think. > > Anyone knows how I can work around that problem? > > Thanks, > Marco > > On 11 May 2012 16:12, Robert Newson <rnew...@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.'); }); >>