NetBSD Web 服务器性能

NetBSD Web 服务器性能

我对 Linux、FreeBSD 和 NetBSD 之间的 Web 服务器性能差异很感兴趣,因为我听说 NetBSD 和 FreeBSD 具有良好的 TCP/IP 实现。
因此,我在 KVM 上设置了具有相同硬件功能的虚拟机(2 个 CPU、RAM:2G、HDD:16G、NIC:virtio),然后分别为 Nginx 安装必要的软件包。
我只是在 ramdisk 上运行了带有静态主页的简单 Nginx(以防止磁盘 I/O 因素)。

我发现 NetBSD 的性能很差,怀疑是 NetBSD 的基础设置比较保守,于是尝试调优一些系统参数,但是 NetBSD 系统调优的资料很少,虽然我也对比 FreeBSD 调优了一些 sysctl 参数,但还是没有好到哪里去。

是否有任何 NetBSD 调整建议,或者 NetBSD 真的不是一个好的 Web 服务器选择?

以下是我的 apache-benchmark 结果:
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

答案1

您正在使用 KVM——请注意,据我所知,在 NetBSD 下,virtio 支持可能仍然相当不均衡。

我认为这解释了 Linux 和 FreeBSD(均支持 virtio)以及 NetBSD 之间的性能差异。

相关内容