Hi,
Just tried to benchmark a simple dns lookup server with NodeJS and the 
results turned me down. 
I've heard NodeJS is good when dealing with heavy IO bound application, but 
my server only serves 20 request/second. 

var express = require('express');var dns = require('dns');var app = 
express();var PORT = process.env.PORT || 3000;

app.get('/', function(req, res) {
  var endpoint = "cloudflare.com";
  dns.resolve(endpoint, function(err, ips) {
    if (err) {
      res.send(JSON.stringify(err));
    } else {
      res.send(JSON.stringify(ips));
    }
  })});

app.listen(PORT);


Benchmark result: (with NODE_ENV set to production, but that doesn't 
improve anything)

ab -n 1000 -c 300 http://slave:4000/
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>Copyright 1996 Adam 
Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache 
Software Foundation, http://www.apache.org/
Benchmarking slave (be patient)Completed 100 requestsCompleted 200 
requests^[[C^[[ACompleted 300 requestsCompleted 400 requestsCompleted 500 
requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 
requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requests

Server Software:        Server Hostname:        slaveServer Port:            
4000
Document Path:          /Document Length:        35 bytes
Concurrency Level:      300Time taken for tests:   61.889 secondsComplete 
requests:      1000Failed requests:        0Total transferred:      230000 bytes
HTML transferred:       35000 bytesRequests per second:    16.16 [#/sec] 
(mean)Time per request:       18566.552 [ms] (mean)Time per request:       
61.889 [ms] (mean, across all concurrent requests)Transfer rate:          3.63 
[Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   maxConnect:      121  176 109.1    148  
  1226Processing:   124 12160 14851.2   5131   61682Waiting:      123 12160 
14851.3   5131   61682Total:        247 12337 14852.1   5309   61886
Percentage of the requests served within a certain time (ms)
  50%   5309
  66%  15018
  75%  18214
  80%  21360
  90%  38872
  95%  44911
  98%  54477
  99%  56875
 100%  61886 (longest request)

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/0cfb32e1-fa6b-4642-941b-b9feb81a5405%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to