Linux – NetBSD web server performance

linuxnetbsdperformanceweb-server

I am interesting in the difference web server performance between Linux, FreeBSD and NetBSD since I have heard that NetBSD and FreeBSD have the good TCP/IP implementation.
As the result, I setup VMs with same hardware capability (2 CPU, RAM:2G, HDD:16G, NIC:virtio) on KVM, and then install essential packages for Nginx respectively.
I just ran simple Nginx with static homepage on ramdisk (for preventing disk I/O factor).

I found that the performance of NetBSD is very bad. I suspect that the basic setting of NetBSD is conservative, so I try to tune some system parameters. However, it's very few resource talking about NetBSD system tuning. Although I tune some sysctl parameters by comparing to FreeBSD, it still not be better.

Is there any NetBSD tuning advice or NetBSD is really not a good choice for web server?

Below is my apache-benchmark result:
ab -r -n 10000 -c 500

Server Software:        LINUX nginx/1.9.3
Server Hostname:        10.128.81.63
Server Port:            80

Document Path:          /
Document Length:        612 bytes

Concurrency Level:      500
Time taken for tests:   0.823 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      8440000 bytes
HTML transferred:       6120000 bytes
Requests per second:    12155.16 [#/sec] (mean)
Time per request:       41.135 [ms] (mean)
Transfer rate:          10018.51 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0       4
Processing:     2   16  78.2      8     817
Waiting:        1   16  78.2      8     817
Total:          6   16  78.4      8     819
------------------------------------------------------------
Server Software:        FreeBSD nginx/1.9.3
Server Hostname:        10.128.81.67
Server Port:            80

Document Path:          /
Document Length:        612 bytes

Concurrency Level:      500
Time taken for tests:   0.443 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      8440000 bytes
HTML transferred:       6120000 bytes
Requests per second:    22577.85 [#/sec] (mean)
Time per request:       22.146 [ms] (mean)
Transfer rate:          18609.09 [Kbytes/sec] received

Connection Times (ms)
          min  mean[+/-sd] median   max
Connect:        0    0   0.5      0       3
Processing:     3   21   7.7     21     214
Waiting:        3   21   7.7     21     214
Total:          6   22   7.6     22     217

------------------------------------------------------------
Server Software:        NetBSD nginx/1.9.3
Server Hostname:        10.128.81.69
Server Port:            80

Document Path:          /
Document Length:        612 bytes

Concurrency Level:      500
Time taken for tests:   1.350 seconds
Complete requests:      10000
Failed requests:        373
   (Connect: 0, Receive: 144, Length: 85, Exceptions: 144)
Total transferred:      8318464 bytes
HTML transferred:       6031872 bytes
Requests per second:    7410.05 [#/sec] (mean)
Time per request:       67.476 [ms] (mean)
Transfer rate:          6019.56 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   29 166.9      0    1003
Processing:     1   20  13.9     19     224
Waiting:        0   20  13.9     19     224
Total:          4   49 169.3     20    1212

Best Answer

You are using KVM -- Please be aware that virtio support may still (AFAIK) be pretty patchy under NetBSD.

I think this explains the performance difference between Linux and FreeBSD (both have virtio support) and NetBSD.