«   2018/08   »
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Archives
Today
326
Total
1,140,506
안정적인 DNS서비스 DNSEver
관리 메뉴

Blue Breeze

Node.js helloWorld 본문

Language/Node.js

Node.js helloWorld

푸른바람 C/H 2018.06.10 08:30

Node.js

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.write('Hello World!');
  res.end();
}).listen(1337);
node app.js

# other terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Concurrency Level:      10
Time taken for tests:   0.766 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      1130000 bytes
HTML transferred:       120000 bytes
Requests per second:    13053.45 [#/sec] (mean)
Time per request:       0.766 [ms] (mean)
Time per request:       0.077 [ms] (mean, across all concurrent requests)
Transfer rate:          1440.47 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     0    1   0.4      1       6
Waiting:        0    1   0.4      1       6
Total:          0    1   0.4      1       6

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      2
  98%      2
  99%      2
 100%      6 (longest request)

Node.js Express

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(1337, function () {
  console.log('Example app listening on port 1337!');
});
node app2.js

# other terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Concurrency Level:      10
Time taken for tests:   0.879 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    10000
Total transferred:      2160000 bytes
HTML transferred:       120000 bytes
Requests per second:    11373.76 [#/sec] (mean)
Time per request:       0.879 [ms] (mean)
Time per request:       0.088 [ms] (mean, across all concurrent requests)
Transfer rate:          2399.15 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     0    1   0.6      1       7
Waiting:        0    1   0.6      1       7
Total:          0    1   0.6      1       7

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      2
  98%      2
  99%      3
 100%      7 (longest request)


'Language > Node.js' 카테고리의 다른 글

node.js json-server  (0) 2018.06.13
Node.js helloWorld  (0) 2018.06.10
node.js Common System Errors  (0) 2018.02.23
express-socket.io-session  (0) 2018.02.13
node.js 64bit int buffer  (0) 2018.01.25
2진수 채우기 zerofill  (0) 2018.01.12
0 Comments
댓글쓰기 폼