OpenBSD httpd

OpenBSD's lightweight webserver is now in FreeBSD's ports tree. so I decided to benchmark it against nginx on one of my spare machines.

Some more articles on OpenBSD's httpd:

Server

FreeBSD: `FreeBSD t3500 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r290273: Mon Nov  2 19:22:49 UTC 2015 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64`

Configs

# cat /usr/local/etc/obhttpd.conf
chroot "/usr/local/www"
prefork 32
server "t3500.lan" {
                listen on * port 81
                root "nginx-dist"
}
# cat /usr/local/etc/nginx/nginx.conf | grep -v # | sed '/^$/d'
worker_processes  1;
events {
        worker_connections  1024;
}
http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        server {
                listen       80;
                server_name  localhost;
                location / {
                        root   /usr/local/www/nginx;
                        index  index.html index.htm;
                }
                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                        root   /usr/local/www/nginx-dist;
                }
        }
}

Results

nginx

$ httperf --num-conns 1000 --server t3500.lan --port 80
httperf --client=0/1 --server=t3500.lan --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=1000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1

Total: connections 1000 requests 1000 replies 1000 test-duration 0.455 s

Connection rate: 2196.8 conn/s (0.5 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 0.4 avg 0.5 max 1.0 median 0.5 stddev 0.1
Connection time [ms]: connect 0.2
Connection length [replies/conn]: 1.000

Request rate: 2196.8 req/s (0.5 ms/req)
Request size [B]: 62.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 0.3 transfer 0.0
Reply size [B]: header 237.0 content 612.0 footer 0.0 (total 849.0)
Reply status: 1xx=0 2xx=1000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.06 system 0.39 (user 13.8% system 86.1% total 100.0%)
Net I/O: 1954.4 KB/s (16.0*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

obhttpd

$ httperf --num-conns 1000 --server t3500.lan --port 81
httperf --client=0/1 --server=t3500.lan --port=81 --uri=/ --send-buffer=4096 --recv-buffer=16384 --num-conns=1000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1

Total: connections 1000 requests 1000 replies 1000 test-duration 105.322 s

Connection rate: 9.5 conn/s (105.3 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 100.0 avg 105.3 max 107.9 median 106.5 stddev 2.3
Connection time [ms]: connect 0.3
Connection length [replies/conn]: 1.000

Request rate: 9.5 req/s (105.3 ms/req)
Request size [B]: 62.0

Reply rate [replies/s]: min 9.4 avg 9.5 max 9.6 stddev 0.1 (21 samples)
Reply time [ms]: response 0.6 transfer 104.5
Reply size [B]: header 195.0 content 612.0 footer 0.0 (total 807.0)
Reply status: 1xx=0 2xx=1000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 10.81 system 94.50 (user 10.3% system 89.7% total 100.0%)
Net I/O: 8.1 KB/s (0.1*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0