nginx Lighttpd Apache 性能测试

测试报告::::::

 

主机环境:

电脑: PC, CPU: AMD1800+, MEM: 728M, DISK: IDE 7200RPM 2M, 160G

系统: FreeBSD6.1-RELEASE-p11

软件:

 Apache-2.0.59

 Lighttpd-1.4.13-1

 nginx-0.5.5

 

测试机:

电脑: Latop IBM T20,P3-700, MEM: 256M

系统: FreeBSD6.2-PRERELEASE

软件: WebBench 1.5

 

静态网页的比较:

index.html是apache2  自带的 index.html.en 拷贝来的。

 

nginx(ports install):

mybsd# webbench -c500 -2http://192.168.8.249:82/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:82/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=429908pages/min, 12360223 bytes/sec.

Requests: 214954susceed, 0 failed.

 

lighttpd(portsinstall):

mybsd# webbench -c500 -2http://192.168.8.249:81/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:81/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=429182pages/min, 12506485 bytes/sec.

Requests: 214591susceed, 0 failed.

 

apache2+worker(portsinstall):

mybsd# webbench -c500 -2http://192.168.8.249:80/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:80/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=80118pages/min, 2337701 bytes/sec.

Requests: 40059susceed, 0 failed.

 

apache2+worker(portsinstall)

enable sendfile();

mybsd# webbench -c500 -2http://192.168.8.249:80/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:80/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=80728pages/min, 2355835 bytes/sec.

Requests: 40364susceed, 0 failed.

 

/opt/modules/apache2(手工安装):

mybsd# webbench -c500 -2http://192.168.8.249:83/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:83/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=95102pages/min, 2774133 bytes/sec.

Requests: 47551susceed, 0 failed.

 

/opt/modules/apache2 worker(手工安装):

mybsd# webbench -c500 -2http://192.168.8.249:83/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:83/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=79100pages/min, 2307692 bytes/sec.

Requests: 39550susceed, 0 failed.

 

 

/opt/modules/apache2pprefork(手工安装):

mybsd# webbench -c500 -2http://192.168.8.249:84/index.html

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:84/index.html(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=106000pages/min, 3093523 bytes/sec.

Requests: 53000susceed, 0 failed.

 

 

PHP支持比较

info.php:

木铎校园 BBS 社区GOz:P)S @

 

phpinfo();

 

?>

 

/opt/modules/apache2prefork(手工安装)

 

mybsd# webbench -c500 -2http://192.168.8.249:83/info.php

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:83/info.php(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=13628pages/min, 9712975 bytes/sec.

Requests: 6814susceed, 0 failed.

 

 

nginx(proxy)+apache2(/opt/modules/apache2(手工安装))

mybsd# webbench -c500 -2http://192.168.8.249:82/info.php

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:82/info.php(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=9954 pages/min,7505740 bytes/sec.

Requests: 4977susceed, 0 failed.

 

 

lighttpd(proxy)+apache2apache2(/opt/modules/apache2(手工安装))

mybsd# webbench -c500 -2http://192.168.8.249:81/info.php

Webbench - Simple WebBenchmark 1.5

Copyright (c) RadimKolar 1997-2004, GPL Open Source Software.

 

Benchmarking:GEThttp://192.168.8.249:81/info.php(using HTTP/1.1)

500 clients, running30 sec.

 

Speed=10150pages/min, 7732128 bytes/sec.

Requests: 5075susceed, 0 failed.

 

 

如果你在Linux下用Apache Bench(ab)测试我这个网站的话,就会发现服务器不是常见的Apache, 而是 nginx.

 

nginx是一个小巧而高效的Linux下的web服务器软件。开发人员 IgorSysoev 来自俄罗斯,nginx的话其实已经在一些俄罗斯的大型网站上运行多年,相当的稳定,最近才在美国开始知名起来。

 

而另外一个热门的web服务器软件是Lighttpd,因为运行在Youtube的后台,所以知名度很高。Lighttpd特色在于它能做Flashstreaming和对fastcgi的支持,这样对于Ruby on Rails之类的程序提速不少,比起Apache要好很多。

 

但是 nginx 要比 Lighttpd更稳定,功能上并不弱于Lighttpd,差不多什么都有,而且比Lighttpd对于URL rewrite的支持更完善一点。

 

不管是 nginx 还是lighttpd, 对于用来提供静态文件都要比Apache好很多很多,主要就是占用的内存小,Apache和这两个小巧的服务器软件来比实在是个庞然大物啊。

 

 

 

另外lighttpd和nginx在fastcgi的支持中,没有明显的差异,就没有将结果记录起来。

从上面的结果来看,在静态支持中,lighttpd和nginx是比apache优胜很多很多的。

即使Apache2+worker,在支持PHP方面,还是不太让人满意。

 

另外从运行时对内存、CPU开销来看,最大是Apache,Lighttpd和 Nginx 比较接近,但是Lighttpd相比Nginx更占资源一些。

 

因此,如果不考虑虚拟主机安全设置的问题,Nginx无疑是最好的选择,其次是Lighttpd。

 

Pastedfrom <http://www.nginx8.cn/nginx/b7/107.html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值