Skip to content

Instantly share code, notes, and snippets.

@redism
Last active December 31, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redism/7923572 to your computer and use it in GitHub Desktop.
Save redism/7923572 to your computer and use it in GitHub Desktop.
단순 GET api call 에 대한 퍼포먼스 테스트 express.js vs nginx+express.js 머신 정보 iMac13.2 4 cores
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:2131/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 10000 requests
Server Software:
Server Hostname: 127.0.0.1
Server Port: 2131
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 49.304 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 4036108 bytes
HTML transferred: 1230000 bytes
Requests per second: 202.82 [#/sec] (mean)
Time per request: 49.304 [ms] (mean)
Time per request: 4.930 [ms] (mean, across all concurrent requests)
Transfer rate: 79.94 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 17 49 13.1 45 211
Waiting: 17 49 13.0 45 211
Total: 17 49 13.1 45 211
Percentage of the requests served within a certain time (ms)
50% 45
66% 53
75% 55
80% 57
90% 60
95% 64
98% 85
99% 108
100% 211 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 10000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 50.850 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 4246600 bytes
HTML transferred: 1230000 bytes
Requests per second: 196.66 [#/sec] (mean)
Time per request: 50.850 [ms] (mean)
Time per request: 5.085 [ms] (mean, across all concurrent requests)
Transfer rate: 81.55 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 17 51 18.9 46 435
Waiting: 17 51 18.9 46 435
Total: 18 51 18.9 46 435
Percentage of the requests served within a certain time (ms)
50% 46
66% 54
75% 56
80% 57
90% 63
95% 66
98% 76
99% 144
100% 435 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 10000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 45.927 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 4246322 bytes
HTML transferred: 1230000 bytes
Requests per second: 217.74 [#/sec] (mean)
Time per request: 45.927 [ms] (mean)
Time per request: 4.593 [ms] (mean, across all concurrent requests)
Transfer rate: 90.29 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 14 427.3 0 13572
Processing: 9 32 25.1 26 301
Waiting: 9 32 25.1 26 301
Total: 10 46 427.9 26 13598
Percentage of the requests served within a certain time (ms)
50% 26
66% 32
75% 38
80% 46
90% 64
95% 82
98% 91
99% 99
100% 13598 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 10000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 49.800 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 4246432 bytes
HTML transferred: 1230000 bytes
Requests per second: 200.80 [#/sec] (mean)
Time per request: 49.800 [ms] (mean)
Time per request: 4.980 [ms] (mean, across all concurrent requests)
Transfer rate: 83.27 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 20 630.1 0 20017
Processing: 9 30 168.4 17 5544
Waiting: 9 30 168.4 17 5544
Total: 9 50 652.0 17 20043
Percentage of the requests served within a certain time (ms)
50% 17
66% 22
75% 26
80% 31
90% 48
95% 73
98% 83
99% 88
100% 20043 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 10000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 54.297 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 4246494 bytes
HTML transferred: 1230000 bytes
Requests per second: 184.17 [#/sec] (mean)
Time per request: 54.297 [ms] (mean)
Time per request: 5.430 [ms] (mean, across all concurrent requests)
Transfer rate: 76.38 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 20 478.5 0 13519
Processing: 9 34 24.7 27 394
Waiting: 9 34 24.7 27 394
Total: 10 54 479.6 27 13610
Percentage of the requests served within a certain time (ms)
50% 27
66% 36
75% 43
80% 50
90% 69
95% 86
98% 94
99% 100
100% 13610 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 3000 -c 10 http://127.0.0.1:2131/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 3000 requests
Server Software:
Server Hostname: 127.0.0.1
Server Port: 2131
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 14.387 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Total transferred: 1210878 bytes
HTML transferred: 369000 bytes
Requests per second: 208.52 [#/sec] (mean)
Time per request: 47.957 [ms] (mean)
Time per request: 4.796 [ms] (mean, across all concurrent requests)
Transfer rate: 82.19 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 23 48 8.4 45 98
Waiting: 22 48 8.4 45 98
Total: 23 48 8.4 45 98
Percentage of the requests served within a certain time (ms)
50% 45
66% 52
75% 55
80% 56
90% 59
95% 62
98% 65
99% 68
100% 98 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 3000 -c 10 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 3000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 9.709 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Total transferred: 1273894 bytes
HTML transferred: 369000 bytes
Requests per second: 309.00 [#/sec] (mean)
Time per request: 32.362 [ms] (mean)
Time per request: 3.236 [ms] (mean, across all concurrent requests)
Transfer rate: 128.14 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 10 32 22.2 25 102
Waiting: 10 32 22.2 25 102
Total: 10 32 22.2 25 102
Percentage of the requests served within a certain time (ms)
50% 25
66% 33
75% 42
80% 49
90% 74
95% 83
98% 88
99% 92
100% 102 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 3000 -c 10 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Completed 3000 requests
Finished 3000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 10
Time taken for tests: 7.089 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Total transferred: 1273944 bytes
HTML transferred: 369000 bytes
Requests per second: 423.19 [#/sec] (mean)
Time per request: 23.630 [ms] (mean)
Time per request: 2.363 [ms] (mean, across all concurrent requests)
Transfer rate: 175.49 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 10 23 15.5 17 94
Waiting: 10 23 15.5 17 94
Total: 10 24 15.5 17 94
Percentage of the requests served within a certain time (ms)
50% 17
66% 23
75% 27
80% 31
90% 43
95% 59
98% 75
99% 81
100% 94 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 5000 -c 100 http://127.0.0.1:2131/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 5000 requests
Server Software:
Server Hostname: 127.0.0.1
Server Port: 2131
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 100
Time taken for tests: 23.605 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 2018364 bytes
HTML transferred: 615000 bytes
Requests per second: 211.82 [#/sec] (mean)
Time per request: 472.109 [ms] (mean)
Time per request: 4.721 [ms] (mean, across all concurrent requests)
Transfer rate: 83.50 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 2
Processing: 120 471 97.1 496 647
Waiting: 120 471 97.1 495 647
Total: 120 471 97.1 496 648
Percentage of the requests served within a certain time (ms)
50% 496
66% 517
75% 533
80% 542
90% 566
95% 581
98% 603
99% 616
100% 648 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 5000 -c 100 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 100
Time taken for tests: 13.348 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 2123052 bytes
HTML transferred: 615000 bytes
Requests per second: 374.58 [#/sec] (mean)
Time per request: 266.968 [ms] (mean)
Time per request: 2.670 [ms] (mean, across all concurrent requests)
Transfer rate: 155.32 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 2
Processing: 10 265 223.0 234 856
Waiting: 10 265 223.0 234 856
Total: 10 266 223.0 234 856
Percentage of the requests served within a certain time (ms)
50% 234
66% 458
75% 474
80% 483
90% 513
95% 542
98% 635
99% 748
100% 856 (longest request)
[-:] redism@~:
[-:] redism@~: ab -n 5000 -c 100 http://127.0.0.1:3003/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 5000 requests
Server Software: nginx/1.4.4
Server Hostname: 127.0.0.1
Server Port: 3003
Document Path: /api/user/1
Document Length: 123 bytes
Concurrency Level: 100
Time taken for tests: 10.402 seconds
Complete requests: 5000
Failed requests: 0
Write errors: 0
Total transferred: 2123210 bytes
HTML transferred: 615000 bytes
Requests per second: 480.67 [#/sec] (mean)
Time per request: 208.041 [ms] (mean)
Time per request: 2.080 [ms] (mean, across all concurrent requests)
Transfer rate: 199.33 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 3
Processing: 10 207 238.4 49 669
Waiting: 10 207 238.4 49 669
Total: 10 207 238.4 49 669
Percentage of the requests served within a certain time (ms)
50% 49
66% 206
75% 524
80% 543
90% 575
95% 592
98% 611
99% 622
100% 669 (longest request)
[-:] redism@~:
@redism
Copy link
Author

redism commented Dec 12, 2013

몇가지 주의할 점은 위의 테스트에서 사용되는 GET /api/user/1은 snapshot을 찍을 때 최초 호출 이후 memcached를 이용하게 된다. 다만 User.id를 이용해서 UserProfile.id를 가지고 오기 위한 DB access는 수행된다.

@redism
Copy link
Author

redism commented Dec 12, 2013

일단 간단히 분석한 결과는 다음과 같다.

  • nginx의 load balancer는 upstream으로 묶여있는 proxy 서버 중 일부가 동작하지 않아도 정상적으로 (되는 서버를 골라서) 잘 라우팅된다.
  • 동시접속자 수가 많아질수록 멀티로 묶은 경우의 전체적인 퍼포먼스가 좋아지는 것으로 보인다. 그렇지 않은 경우에는 크게 차이가 나지 않는 것 같다. 즉, 굉장히 intensive하게 동시접속자가 늘어나기 전까지는 왠만하면 클러스터를 구지 묶을 필요가 없다는 뜻이기도?
  • 실제 동작할 머신의 구성에서 직접 실험해 보는것이 정확할 것이다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment