Skip to content

Instantly share code, notes, and snippets.

@cubicdaiya
Last active August 29, 2015 14:18
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 cubicdaiya/6104956d691efce1e292 to your computer and use it in GitHub Desktop.
Save cubicdaiya/6104956d691efce1e292 to your computer and use it in GitHub Desktop.
nginx benchmark

環境

  • nginx-1.7.11
  • c4.8xlarge

ベンチマークコマンド

./wrk -c 100 -t 10 -d 10 http://127.0.0.1/

sysctl

net.core.somaxconn=32768
net.core.netdev_max_backlog=32768
net.ipv4.tcp_max_syn_backlog=32768
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_fin_timeout=10
net.ipv4.ip_local_port_range= 1024 65535

またaccess_log offではじめる

初期状態

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency    47.15ms   61.39ms 215.90ms   78.76%
Req/Sec     5.16k     2.54k   10.10k    61.94%
509618 requests in 10.02s, 413.08MB read
Requests/sec:  50861.62
Transfer/sec:     41.23MB

backlogを増やす -> 8192

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency    44.86ms   58.33ms 203.92ms   78.75%
Req/Sec     5.52k     2.76k   10.10k    61.34%
537154 requests in 10.01s, 435.40MB read
Requests/sec:  53640.15
Transfer/sec:     43.48MB

worker_process -> 18, worker_connections -> 10240, worker_cpu_affinity

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency     2.18ms   14.29ms 221.92ms   98.09%
Req/Sec    61.66k     9.33k   89.01k    92.40%
6137584 requests in 10.10s, 4.86GB read
Requests/sec: 607673.28
Transfer/sec:    492.57MB

tcp_nopush on

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency     1.46ms   10.03ms 171.50ms   98.10%
Req/Sec    70.23k    12.11k  116.93k    79.90%
6992707 requests in 10.10s, 5.54GB read
Requests/sec: 692392.82
Transfer/sec:    561.24MB

accept_mutex_delay 100ms

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency   453.48us    3.87ms  88.14ms   98.93%
Req/Sec    71.90k     7.91k  101.17k    92.57%
7216973 requests in 10.10s, 5.71GB read
Requests/sec: 714591.83
Transfer/sec:    579.23MB

open_file_cache 100

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency   178.38us    1.17ms  45.78ms   99.13%
Req/Sec    73.93k    10.03k  104.41k    83.96%
7426789 requests in 10.10s, 5.88GB read
Requests/sec: 735344.28
Transfer/sec:    596.05MB

worker_cpu_affinityをoff(設定ミスってた)

Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency     1.06ms    9.54ms 265.44ms   98.51%
Req/Sec    79.79k    10.76k  105.64k    67.33%
7997093 requests in 10.10s, 6.33GB read
Requests/sec: 791807.46
Transfer/sec:    641.86MB

補足

multi_acceptとkeepalive_requestsは効果なかった。

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