三大WEB服务器对比分析(apache ,lighttpd,nginx)

http://www.linuxany.com/archives/1368.html

在相对大 的网站,节约下来的服务器成本无疑是客观的。而有些小型网站往往服务器不多,如果采用 Apache 这类传统 Web 服务器,似乎也还能撑 过去。但有其很明显的弊端: Apache 在处理流量爆发的时候(比如爬虫或者是 Digg 效应) 很容易过载,这样的情况下采用 Nginx 最为合适。

建议方案:

Apache 后台服务器(主要处理php及一些功能请求 如:中文url)

Nginx  前端服务器(利用它占用系统资源少得优势来处理静态页面 大量请求)

Lighttpd 图片服务器

总体来说,随着nginx功能得完善将使他成为今后web server得主流。

3种WEB服务器的比较:

server Apache Nginx Lighttpd
Proxy代理 非常好 非常好 一般
Rewriter 非常好 一般
Fcgi 不好 非常好
热部署 不支持 支持 不支持
系统压力比较 很大 很小 比较小
稳定性 非常好 不好
安全性 一般 一般
技术支持 非常好 很少 一般
静态文件处理 一般 非常好
Vhosts虚拟主机 支持 不支持 支持
反向代理 一般 非常好 一般
Session sticky 支持 不支持 不支持
epoll 不支持 支持 支持

性能测试

将分别测试3种软件在对动态页面和静态页面请求及并发时的响应时间

l        静态页面 搜狐首页

LIGHTTPD

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 64 60 462.75 21.6
100000/200 67 60 312.07 32.4
100000/500 83 60 137.24 72.8
100000/1000

出现错误丢包

94 60 126.6 78.9

NGINX

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 34.6 140 943.66 10.597
100000/200 35.6 110 924.32 10.818
100000/500 34.3 110 912.68 10.956
100000/1000 37 160 832.59 12.106

APACHE

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 40.6 170 690.72 14.47
100000/200 41.1 180 685.39 14.59
100000/500 42.3 190 633.64 15.78
100000/1000 43.1 200 547.53 18.26

l        动态页面 内部社区首页

LIGHTTPD

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
1000/100 50 200 33.54 29.816
1000/200 52 210 30.43 32.858
1000/500 54 230 25.79 38.76
1000/1000 62 250 24.83 40.28

NGINX

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
1000/100 53.8 250 83.12 12.305
1000/200 55.8 250 74.05 13.504
1000/500 56 260 58.99 16.951
1000/1000 58 260 43.41 23.347

APACHE

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 60 200 27.37 36.541
100000/200 61 220 23.82 41.981
100000/500 73 150 20.59 48.562
100000/1000 53 200 27.18 36.796

l        PHPINFO函数页

LIGHTTPD

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 45 20 168.06 59.504
100000/200 47 22 140.64 71.103
100000/500 49 24 52.80 189.386
100000/1000 在请求到4840时测试测试程序死掉

NGINX

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 70 120 143.46 69.706
100000/200 72 130 140.57 71.140
100000/500 73 150 135.87 73.601
100000/1000 77 160 132.18 75.657

APACHE 出现丢包

n/-c(ab参数) cpu% Mem RequestsperSecond Time taken for tests
100000/100 70 180 245.73 40.694
100000/200 72 190 245.79 40.684
100000/500 75 200 241.29 41.443
100000/1000 77 220 236.74 42.239

各大网站WEB服务器资源列表

网站名   操作系统   web服务器

1.门户网站类:

搜狐     LINUX           apache 1.3.37

新浪     LINUX           apache 2.0.54

迅雷     LINUX           nginx 0.6.31

163      LINUX           apache 2.2.6

2.搜索类

百度      unknown        BWS 1.0

Google   linux           gws

Sougou   FreeBSD         apache 2.2.4

Hao123   linux          apache 2.2.4

4. 电子邮箱类

126        linux         apache

Hotmail    win2003      microsoft-IIS 6.0

新浪邮箱    F5 Big-IP    apache 2.2.8

263        linux         apache 2.2.6

5. 博客类

新浪博客    linux          nginx 0.5.35

搜狐博客    linux          nginx

迅雷博客    linux          nginx 0.6.32

天涯博客    F5 Big-IP      Microsoft-IIS/5.0

6.视频类

优酷         linux          apache

土豆         linux          apache

Ku6         linux           apache

六间房       linux          nginx 0.6.14

Lighttpd:单台支持上万并发;请求处理速度是Apache的3-5倍;对多CPU支 持不太好;有内存泄漏问题
典型范例-YouTube、Mop、SF、豆瓣
豆瓣如今很多lightty也改为Nginx了,留下图片服务器 使用lighttpd。

Nginx(Engin X) 处理速度比Lighttpd快10%-15%;在Proxy方面,Nginx>Lighttpd;在FastCGI支持方 面,Lighttpd>Nginx;典型范例-六间房,新浪Blog

Apache 使用范围最广;在高负载环境下,性能不突出,单台仅能承受上千个并发数;对DOS(拒绝服务攻击)抵御能力差;只有Apache 1.3对FastCGI有支持,不适合使用3P(PHP、Perl和Python)的Web2.0站点

如果是新兴的Web Server 2.0站点,Lighttpd和Nginx凭借对FastCGI的支持,和高负载下的良好表现,将会是最好的选择;如果是传统站点,Apache是最通用 的选择。

你可能感兴趣的:(性能测试,apache,lighttpd,nginx,web服务,linux,服务器)