Hi guys, I've post this question at 
stackoverflow<http://stackoverflow.com/questions/12833673/weird-behaviour-with-nodejs-and-apache-benchmark>,
 
but I thought this group might be a better place for it:

I'm testing out nodejs (0.8.11).

with the following server app:

    var http = require('http');
    http.createServer(function (req, res) {
        console.log('hit!');
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.end('Hello World\n');
    }).listen(1337, '127.0.0.1');
    console.log('Server running at http://127.0.0.1:1337/');


I ran apache benchmark:

ab -r -v 4 'http://127.0.0.1:1337/'


I get the following output:

    hit!
    hit!
    hit!
    hit!
    hit!
    hit!
    hit!
    hit!
    hit!
    ... (alot more)

output from ab:

    Benchmarking 127.0.0.1 (be patient)...INFO: POST header == 
    ---
    GET / HTTP/1.0
    Host: 127.0.0.1:1337
    User-Agent: ApacheBench/2.3
    Accept: */*
    
    
    ---
    LOG: header received:
    HTTP/1.1 200 OK
    Content-Type: text/plain
    Date: Thu, 11 Oct 2012 06:40:04 GMT
    Connection: close
    
    Hello World
    
    LOG: Response code = 200
    ..done
    
    
    Server Software:        
    Server Hostname:        127.0.0.1
    Server Port:            1337
    
    Document Path:          /
    Document Length:        12 bytes
    
    Concurrency Level:      1
    Time taken for tests:   0.009 seconds
    Complete requests:      1
    Failed requests:        0
    Write errors:           0
    Total transferred:      113 bytes
    HTML transferred:       12 bytes
    Requests per second:    115.05 [#/sec] (mean)
    Time per request:       8.692 [ms] (mean)
    Time per request:       8.692 [ms] (mean, across all concurrent 
requests)
    Transfer rate:          12.70 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:        8    8   0.0      8       8
    Processing:     0    0   0.0      0       0
    Waiting:        0    0   0.0      0       0
    Total:          9    9   0.0      9       9

and thinking the default number of requests isn't 1 as is specified in ab 
manual, i tried:

    ab -v 4 -n 1 -c 1 'http://127.0.0.1:1337/'

I get the same output (alot of 'hits!' in the log)

I would expect there to be only one 'hit!' message in the log when it is 
hit with 1 request... The funny thing is, the application behaves correctly 
(with only 1 'hit!' message in the log) when I curled it.

What is going on here?

This is specific to node, I've tried the same with my jetty app, with `ab 
-c 1 -n 1`, there was only 1 recorded hit...

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to