[benchmarks] Add initial real NGinx benchmarking support.

This commit is contained in:
Ciprian Dorin Craciun 2021-12-23 17:48:41 +02:00
parent 24aa5198e7
commit 1312019c1b
2 changed files with 69 additions and 37 deletions

View file

@ -1,13 +1,22 @@
master_process off;
worker_processes 0;
worker_rlimit_nofile 131072;
events {
use epoll;
worker_connections 16640;
accept_mutex off;
multi_accept off;
}
http { http {
root @{nginx}/store;
index index.html index.txt; index index.html index.txt;
autoindex off; autoindex off;
include /dev/null;
default_type application/octet-stream; default_type application/octet-stream;
gzip off; gzip off;
@ -17,22 +26,25 @@ http {
gzip_proxied any; gzip_proxied any;
gzip_types *; gzip_types *;
server { server {
listen @{bind_ip}:@{bind_port} default_server bind backlog=65536; listen @{nginx_bind_http} bind reuseport deferred backlog=65536;
server_name nginx; server_name nginx;
server_tokens off; server_tokens off;
server_name_in_redirect off; server_name_in_redirect off;
port_in_redirect off; port_in_redirect off;
keepalive_disable none;
keepalive_requests 262144; keepalive_requests 262144;
keepalive_timeout 60s; keepalive_timeout 60s;
tcp_nodelay off; tcp_nodelay off;
tcp_nopush off; tcp_nopush off;
sendfile off; sendfile off;
directio off; directio off;
aio off; aio off;
@ -51,9 +63,7 @@ http {
limit_except GET HEAD { limit_except GET HEAD {
deny all; deny all;
} }
} }
} }
@ -61,27 +71,18 @@ http {
access_log off; access_log off;
log_not_found on; log_not_found on;
client_body_temp_path @{nginx}/empty; root @{nginx_root};
proxy_temp_path @{nginx}/empty;
fastcgi_temp_path @{nginx}/empty; client_body_temp_path @{nginx_empty};
uwsgi_temp_path @{nginx}/empty; proxy_temp_path @{nginx_empty};
scgi_temp_path @{nginx}/empty; fastcgi_temp_path @{nginx_empty};
uwsgi_temp_path @{nginx_empty};
scgi_temp_path @{nginx_empty};
} }
worker_processes 2; working_directory @{nginx_empty};
worker_rlimit_nofile 131072;
working_directory @{nginx}/empty;
error_log /dev/stderr notice; error_log /dev/stderr notice;
pid @{nginx}/pid; pid @{nginx_pid};
daemon off; daemon off;
events {
use epoll;
worker_connections 16640;
accept_mutex off;
multi_accept off;
}

View file

@ -176,19 +176,7 @@
test "${#}" -ge 1 test "${#}" -ge 1
_mode="${1}" _mode="${1}"
shift -- 1 shift -- 1
if test "${#}" -ge 1 ; then
if test "${1:0:1}" != '-' ; then
_archive="${1}"
shift -- 1
else
_archive=''
fi
else
_archive=''
fi
if test -z "${_archive}" ; then
_archive=./examples/hello-world.cdb _archive=./examples/hello-world.cdb
fi
_arguments=() _arguments=()
case "${_mode}" in case "${_mode}" in
( http-all ) ( http-all )
@ -352,6 +340,49 @@
:: benchmark / nginx / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / nginx' 1 "${@}"
:: benchmark / nginx / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / nginx' 2 "${@}"
<< benchmark / nginx
test "${#}" -ge 1
_count="${1}"
shift -- 1
_archive=./examples/hello-world
sed \
-r \
-e 's#@\{nginx_root\}#'"${_archive}"'#g' \
-e 's#@\{nginx_bind_http\}#127.9.185.194:8080#g' \
-e 's#@\{nginx_empty\}#/var/lib/empty#g' \
-e 's#@\{nginx_pid\}#/tmp/nginx.pid#g' \
< ./examples/nginx/nginx.conf \
>| ./examples/nginx/nginx.conf.tmp \
#
_arguments=(
-c ./examples/nginx/nginx.conf.tmp
-e /dev/stderr
-p .
)
exec -- \
"${ZRUN[@]}" ':: benchmark / execute / multiple' "${_count}" \
"${ZRUN[@]}" ':: benchmark / execute / server' \
noenvironment \
./.bin/nginx \
"${_arguments[@]}" \
"${@}" \
#
!!
:: benchmark / dummy / fasthttp / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 1 1 "${@}" :: benchmark / dummy / fasthttp / 1x1 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 1 1 "${@}"
:: benchmark / dummy / fasthttp / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 1 2 "${@}" :: benchmark / dummy / fasthttp / 1x2 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 1 2 "${@}"
:: benchmark / dummy / fasthttp / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 2 1 "${@}" :: benchmark / dummy / fasthttp / 2x1 :: exec -- "${ZRUN[@]}" ':: benchmark / dummy / fasthttp' 2 1 "${@}"