# ============================================================================= # settings.conf - every tunable value for the Nginx kit, in one place # ============================================================================= # Both start-nginx.sh and test-nginx.sh read this file. # Edit a value here, then re-run ./start-nginx.sh so Nginx picks it up. # # Any value can also be overridden for a single run from the command line: # DURATION=30 ./test-nginx.sh throughput # ============================================================================= # ----------------------------------------------------------------------------- # 0. Which Nginx version to install # ----------------------------------------------------------------------------- # Empty = the standard RHEL 9 nginx package (version 1.20). # RHEL 9.6 also offers newer versions as "module streams": 1.22, 1.24, 1.26. # Example: NGINX_STREAM="1.26". Used only when installing from a local # repository (RHEL DVD); for rpms/ choose the version in download-rpms.sh. NGINX_STREAM="${NGINX_STREAM:-}" # ----------------------------------------------------------------------------- # 1. Where Nginx is reached # ----------------------------------------------------------------------------- # The test only talks to the local machine (no traffic leaves the host). # Port 80 is the normal web port. If another web server (for example Apache # httpd) already uses port 80, choose another port that SELinux allows for # web servers: 81, 443, 488, 8008, 8009, 8443 or 9000. NGINX_HOST="${NGINX_HOST:-127.0.0.1}" NGINX_PORT="${NGINX_PORT:-80}" # The "proxy" test needs a backend: an application server that Nginx forwards # requests to. The kit adds a small second server inside Nginx itself, which # listens only on 127.0.0.1 on this port and plays the part of the backend. BACKEND_PORT="${BACKEND_PORT:-8008}" # ----------------------------------------------------------------------------- # 2. Files and folders used on the server # ----------------------------------------------------------------------------- # Test web pages are placed in a sub-folder of the normal RHEL web root, so # they get the correct SELinux label (httpd_sys_content_t) automatically. TEST_CONTENT_DIR="/usr/share/nginx/html/perf-test" # The kit writes its own /etc/nginx/nginx.conf. The original file is saved # once under this name, and "./start-nginx.sh cleanup" puts it back. NGINX_CONF="/etc/nginx/nginx.conf" NGINX_CONF_BACKUP="/etc/nginx/nginx.conf.before-perf-test" # systemd drop-in that raises the open-files limit of nginx.service. SYSTEMD_DROPIN="/etc/systemd/system/nginx.service.d/zz-perf-test.conf" # ----------------------------------------------------------------------------- # 3. Nginx worker settings # ----------------------------------------------------------------------------- # Nginx runs one master process and a few worker processes. Each worker # serves many connections at once (it never waits for one client). # Maximum connections = WORKER_PROCESSES x WORKER_CONNECTIONS WORKER_PROCESSES="${WORKER_PROCESSES:-auto}" # "auto" = one per CPU core WORKER_CONNECTIONS="${WORKER_CONNECTIONS:-4096}" # connections per worker (RHEL default 1024) # Every connection is an open file. The limit must be above # WORKER_CONNECTIONS x 2 (a proxied request uses two connections). OPEN_FILES_LIMIT="${OPEN_FILES_LIMIT:-65536}" KEEPALIVE_TIMEOUT="${KEEPALIVE_TIMEOUT:-65}" # seconds an idle connection stays open (RHEL default) # Requests allowed on one keep-alive connection before Nginx closes it. # The Nginx default is 1000. A fast benchmark reaches that in under a second # per client, and ApacheBench (ab) then counts the closures as failures, # so the kit uses a very high value. KEEPALIVE_REQUESTS="${KEEPALIVE_REQUESTS:-1000000}" LISTEN_BACKLOG="${LISTEN_BACKLOG:-511}" # queue for new connections (Nginx default 511) GZIP_LEVEL="${GZIP_LEVEL:-1}" # 1 = fastest ... 9 = smallest (Nginx default 1) UPSTREAM_KEEPALIVE="${UPSTREAM_KEEPALIVE:-32}" # idle connections kept open to the backend, per worker # Writing an access-log line for every request costs some speed. "off" measures # Nginx itself; "on" shows the cost of logging (log: /var/log/nginx/perf-test-access.log). TEST_ACCESS_LOG="${TEST_ACCESS_LOG:-off}" # ----------------------------------------------------------------------------- # 4. How hard and how long each test runs # ----------------------------------------------------------------------------- DURATION="${DURATION:-10}" # seconds of load for each test run CONCURRENCY="${CONCURRENCY:-50}" # simultaneous clients for most tests CONCURRENCY_LEVELS="${CONCURRENCY_LEVELS:-1 10 50 100 500 1000}" # "concurrency" test steps ERROR_TEST_CONCURRENCY="${ERROR_TEST_CONCURRENCY:-1000}" # "errors" test (overload) CONNECTIONS_TEST_CLIENTS="${CONNECTIONS_TEST_CLIENTS:-1000}" # "connections" test (keep-alive) STARTUP_ROUNDS="${STARTUP_ROUNDS:-3}" # restarts measured by the "startup" test RELOAD_COUNT="${RELOAD_COUNT:-5}" # configuration reloads during the "reload" test # One ApacheBench (ab) process uses one CPU core and tops out at roughly # 50,000 requests/s - often less than Nginx can serve. The clients are therefore # split over several ab processes running side by side. # "auto" = half of the CPUs, at most 8. Use 1 on a machine with 1-2 CPUs. AB_PROCESSES="${AB_PROCESSES:-auto}" # ----------------------------------------------------------------------------- # 5. Pass / fail targets # ----------------------------------------------------------------------------- # These are sensible starting points for a small RHEL 9 server serving static # files over localhost. Adjust them to your own hardware and service targets. # A result that misses its target is reported as FAIL; see # PERFORMANCE-METRICS.md for what each number means. TARGET_STARTUP_MAX_MS="${TARGET_STARTUP_MAX_MS:-3000}" # start until first page served TARGET_THROUGHPUT_MIN_RPS="${TARGET_THROUGHPUT_MIN_RPS:-5000}" # requests/second, at least TARGET_LATENCY_P95_MAX_MS="${TARGET_LATENCY_P95_MAX_MS:-20}" # 95% of requests faster than TARGET_LATENCY_P99_MAX_MS="${TARGET_LATENCY_P99_MAX_MS:-50}" # 99% of requests faster than TARGET_SCALING_MIN_PCT="${TARGET_SCALING_MIN_PCT:-50}" # throughput kept at top level vs peak TARGET_TRANSFER_MIN_MBPS="${TARGET_TRANSFER_MIN_MBPS:-100}" # MB/second, at least TARGET_PROXY_MIN_RPS="${TARGET_PROXY_MIN_RPS:-2000}" # proxied requests/second, at least TARGET_RELOAD_MAX_FAILED="${TARGET_RELOAD_MAX_FAILED:-0}" # failed requests during reloads, at most TARGET_ERROR_RATE_MAX_PCT="${TARGET_ERROR_RATE_MAX_PCT:-0.1}" # failed requests under overload, at most % TARGET_CONNECTIONS_MAX_PCT="${TARGET_CONNECTIONS_MAX_PCT:-80}" # open connections vs maximum, at most % TARGET_CPU_MAX_PCT="${TARGET_CPU_MAX_PCT:-90}" # share of all CPUs Nginx may use TARGET_MEMORY_MAX_MB="${TARGET_MEMORY_MAX_MB:-512}" # peak Nginx memory, at most