Strange behavior with NodeJS and apache tests

I am testing nodejs (0.8.11).

with the following server application:

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 the apache test:

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 assuming that the default number of requests is not 1, as indicated in the ab statement, I tried:

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

I get the same output (a lot in 'log!) In the log)

What's going on here?

This refers to node, I tried the same with my berth, with ab -c 1 -n 1 , there was only 1 hit recorded ...

NOTE. I tried using curling node - only 1 'hit!' In the magazine...

+4
source share
2 answers

I also posted this in google nodejs group. This seems to be a bug in the macacx lion apache / ab version.

Original answer from nodejs group:

https://groups.google.com/d/msg/nodejs/OqVZ4zPbqp0/DitO9xkmFOUJ

There is also a direct link to the corresponding page describing the problem.

+4
source

What's going on here?

Each β€œhit” is a new connection. Why does this look wrong from your point of view?

0
source

Source: https://habr.com/ru/post/1439080/


All Articles