To check port exhaustion:
$ netstat -tanp tcp | grep TIME_WAIT
and see if that prints off a huge number of ports.
To fix, Google for widening the ephemeral port range. Its a sysctl
setting. There's also a way to decrease the tcp_fin_timeout so that
sockets don't stay in TIME_WAIT as long (though you sure want to make
sure this is only on your test rig).
On Fri, May 11, 2012 at 4:22 PM, Robert Newson <[email protected]> wrote:
> 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 <[email protected]> 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 <[email protected]> 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.'); });
>>>