FreeBSD Linux Benchmark
FreeBSD and Linux Nginx benchmark
Pritunl Cloud provides FreeBSD images, these can be useful for load balancers. FreeBSD can provide slightly better Nginx performance. The benchmark below measured 11811.41 requests/sec
on Linux and 12316.09 requests/sec
on FreeBSD.
Test Server
Both tests were run on a Linux and FreeBSD Pritunl Cloud instance with 4 virtual CPUs. The Pritunl Cloud host had an AMD EPYC 7401P processor. The HTTP client was run on a Linux Pritunl Cloud instance with 4 virtual CPUs. The Nginx configuration files below were used. Linux used epoll
connection processing and FreeBSD used kqueue
. These are the most efficient methods for each operating system.
Linux Nginx Configuration
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 400000;
pcre_jit on;
events {
worker_connections 20000;
multi_accept on;
use epoll;
}
http {
server_tokens off;
charset utf-8;
tcp_nopush on;
tcp_nodelay on;
access_log off;
connection_pool_size 1024;
request_pool_size 8k;
server {
listen 80;
listen [::]:80;
root /usr/share/nginx/html;
server_name _;
location / {
default_type application/json;
return 200 "{}";
}
}
}
FreeBSD Nginx Configuration
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 400000;
pcre_jit on;
events {
worker_connections 20000;
multi_accept on;
use kqueue;
}
http {
server_tokens off;
charset utf-8;
tcp_nopush on;
tcp_nodelay on;
access_log off;
connection_pool_size 1024;
request_pool_size 8k;
server {
listen 80;
listen [::]:80;
root /usr/share/nginx/html;
server_name _;
location / {
default_type application/json;
return 200 "{}";
}
}
}
Linux Nginx Benchmark
ab -c 8 -n 1000000 http://123.123.123.123/
Server Software: nginx
Server Hostname: 123.123.123.123
Server Port: 80
Document Path: /
Document Length: 2 bytes
Concurrency Level: 8
Time taken for tests: 84.664 seconds
Complete requests: 1000000
Failed requests: 0
Total transferred: 143000000 bytes
HTML transferred: 2000000 bytes
Requests per second: 11811.41 [#/sec] (mean)
Time per request: 0.677 [ms] (mean)
Time per request: 0.085 [ms] (mean, across all concurrent requests)
Transfer rate: 1649.44 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 8
Processing: 0 0 0.1 0 9
Waiting: 0 0 0.1 0 8
Total: 0 1 0.1 1 9
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 9 (longest request)
FreeBSD Nginx Benchmark
ab -c 8 -n 1000000 http://123.123.123.123/
Server Software: nginx
Server Hostname: 123.123.123.123
Server Port: 80
Document Path: /
Document Length: 2 bytes
Concurrency Level: 8
Time taken for tests: 81.195 seconds
Complete requests: 1000000
Failed requests: 0
Total transferred: 143000000 bytes
HTML transferred: 2000000 bytes
Requests per second: 12316.09 [#/sec] (mean)
Time per request: 0.650 [ms] (mean)
Time per request: 0.081 [ms] (mean, across all concurrent requests)
Transfer rate: 1719.92 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 4
Processing: 0 0 0.1 0 4
Waiting: 0 0 0.1 0 4
Total: 0 1 0.1 1 4
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 4 (longest request)
Updated almost 2 years ago