因为我听说NetBSD和FreeBSD具有良好的TCP / IP实现,所以在Linux,FreeBSD和NetBSD之间的差别Web服务器性能方面,我感到很有趣。
因此,我在KVM上设置了具有相同硬件function(2个CPU,RAM:2G,HDD:16G,NIC:virtio)的虚拟机,然后分别为Nginx安装必要的软件包。
我只是在虚拟硬盘上运行简单的Nginx和静态主页(用于防止磁盘I / O因素)。
我发现NetBSD的性能非常糟糕。 我怀疑NetBSD的基本设置是保守的,所以我尝试调整一些系统参数。 但是,关于NetBSD系统调优的资源很less。 尽pipe我通过与FreeBSD比较来调整一些sysctl参数,但它仍然不是更好。
有没有NetBSD的调整build议,或者NetBSD真的不是Web服务器的好select?
以下是我的apache基准testing结果:
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
您正在使用KVM – 请注意,在NetBSD下,virtio支持仍然可能(AFAIK)非常糟糕。
我认为这解释了Linux和FreeBSD(都支持virtio)和NetBSD之间的性能差异。