nginx和httpd 2.4.4简单对比

其实之前http 2.4.1刚出来的时候就很多做对比的了。 大部分分测试表明对于静态文件而已,nginx的性能还是会稍微好些,但是event模式下的httpd比之前的性能是提升得太多太多了。httpd安装起来比较麻烦,尤其是在老掉牙的机器上。

httpd 2.4.4在RHEL 4.8的安装过程大概这样的:

  1. 下载最新的httpd 2.4.4解压,然后再下载apr-1.4.6.tar.bz2和apr-util-1.5.1.tar.bz2放到httpd目录下的srclib,解压后把文件夹更名为apr和apr-util.
    2.安装新版的pcre,我直接在 http://downloads.sourceforge.net/project/pcre/pcre/8.32/pcre-8.32.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.32%2F&ts=1362923206&use_mirror=nchc上下载的.然后编译安装pcre
    ./configure –prefix=/opt/install/pcre-8.32 –enable-pcre32 –enable-jit –enable-utf –enable-pcre16

3.配置httpd编译
./configure –prefix=/opt/install/httpd-2.4.4 –enable-rewrite –enable-cache –enable-ssl –enable-static-ab –enable-ssl –with-included-apr –with-pcre=/opt/install/pcre-8.32/–with-mpm=event

安装好后简单做了一个测试,0.6k的小页面。

  
nginx 10 25858.43 0.387  
httpd 10 14952.54 0.669  
nginx 20 27045.38 0.739  
httpd 20 14793.54 1.352  
nginx 30 28513.76 1.052  
httpd 30 13755.20 2.181  
nginx 40 26083.62 1.534  
httpd 40 14023.01 2.852  
nginx 50 27685.62 1.806  
httpd 50 14813.10 3.375  
nginx 60 26779.80 2.240  
httpd 60 14539.48 4.127  
nginx 70 26792.31 2.613  
httpd 70 15989.91 4.378  
nginx 80 28039.97 2.853  
httpd 80 16502.71 4.848  
nginx 90 26900.55 3.346  
httpd 90 15947.58 5.643  
nginx 100 38173.08 2.620  
httpd 100 16635.71 6.011  
nginx 110 28921.72 3.803  
httpd 110 16162.35 6.806  
nginx 120 25804.12 4.650  
httpd 120 16637.97 7.212  
nginx 130 26505.68 4.905  
httpd 130 18882.23 6.885  
nginx 140 29669.50 4.719  
httpd 140 19844.80 7.055  
nginx 150 28969.08 5.178  
httpd 150 19787.36 7.581  
nginx 160 27424.76 5.834  
httpd 160 19325.51 8.279  
nginx 170 28747.23 5.914  
httpd 170 21197.41 8.020  
nginx 180 27160.77 6.627  
httpd 180 23673.76 7.603  
nginx 190 27627.75 6.877  
httpd 190 21609.25 8.793  
nginx 200 24602.16 8.129  
httpd 200 21169.24 9.448  
nginx 210 26838.70 7.825  
httpd 210 21666.67 9.692  
nginx 220 31374.85 7.012  
httpd 220 21994.93 10.002  
nginx 230 27740.35 8.291  
httpd 230 22525.72 10.211  
nginx 240 27235.49 8.812  
httpd 240 21815.80 11.001  
nginx 250 26522.97 9.426  
httpd 250 22031.17 11.348  
nginx 260 25099.80 10.359  
httpd 260 22568.75 11.520  
nginx 270 26291.50 10.269  
httpd 270 22478.80 12.011  
nginx 280 25170.07 11.124  
httpd 280 21437.80 13.061  
nginx 290 24715.85 11.733  
httpd 290 21608.02 13.421  
nginx 300 24808.90 12.092  
httpd 300 21850.39 13.730  
nginx 310 27543.54 11.255  
httpd 310 23166.22 13.382  
nginx 320 26233.97 12.198  
httpd 320 23188.51 13.800  
nginx 330 25436.90 12.973  
httpd 330 23033.17 14.327  
nginx 340 26146.07 13.004  
httpd 340 23096.69 14.721  
nginx 350 25621.51 13.660  
httpd 350 23384.09 14.967  
nginx 360 26820.90 13.422  
httpd 360 22797.59 15.791  
nginx 370 25497.89 14.511  
httpd 370 22911.63 16.149  
nginx 380 25046.86 15.172  
httpd 380 22242.29 17.085  
nginx 390 26514.52 14.709  
httpd 390 22806.97 17.100  
nginx 400 24104.89 16.594  
httpd 400 22924.32 17.449  
nginx 410 26306.69 15.585  
httpd 410 22585.88 18.153  
nginx 420 26518.78 15.838  
httpd 420 22691.66 18.509  
nginx 430 27305.07 15.748  
httpd 430 23292.43 18.461  
nginx 440 27557.12 15.967  
httpd 440 22258.63 19.768  
nginx 450 26536.61 16.958  
httpd 450 22237.17 20.236  
nginx 460 25901.85 17.759  
httpd 460 22664.55 20.296  
nginx 470 24743.76 18.995  
httpd 470 22935.42 20.492  
nginx 480 26813.46 17.901  
httpd 480 23693.59 20.259  
nginx 490 25869.61 18.941  
httpd 490 23374.27 20.963  
nginx 500 24618.19 20.310  
httpd 500 22318.36 22.403  

从图可以看出httpd 2.4.4在高并发的还是略逊于nginx。nginx_httpd0 (3)