news - discount xanax online without prescription, order xanax overnight, alprazolam without prescription overnight, bupropion and alprazolam, cheap soma by money order, ordering soma online without a prescription, cheapest phentermine, phentermine without prescription, taking acomplia while pregnant, buy acomplia online in georgia, buy tramadol online no prescription, buy tramadol webmed, ultram no script needed overnight, ultram shipped cod only, ativan no prior script, buy ativan online with cod cash on delivery, buy free overnight pharmacy lorazepam, cheap lorazepam pills online, fioricet soma tramadol viagra, overnight generic viagra cheap, cialis onset time, cialis 20 mg vs 10 mg, ambien without prescription cheap, cheap ambien without prescription overnight delivery, online pharmaceutical Valium, buy Valium free consultation, buy fioricet online addarol, diet pill blog discussion fioricet, Meridia information, buy cheap discount online Meridia, zithromax cod overnight, find no prescription zithromax, adipex p shipped cod for cheap, adipex over the counter in canada, levitra on line ordering 50mg, no prescription online pharmacy levitra, buy zolpidem over the counter for sale, cheap zolpidem cod free fedex, propecia order online, buy xenical and propecia online, purchase klonopin cod next day delivery, canine klonopin side effects
Home > Web Server > lighttpd,thttpd,shttpd - 轻量级WebServer介绍

lighttpd,thttpd,shttpd - 轻量级WebServer介绍

June 19th, 2006 allen Leave a comment Go to comments

文章可以转载, 但需要以超链接形式标明文章原始出处 http://blogs.huihoo.com

转自 Zhiqiang::He 博客.

国内绝大部分的web server不是IIS就是Apache,而论市场占有率,我认为Apache是大赢家了,至少是占据了半壁江山。

但除了IIS/Apache外,其实我们有很多选择,对于高负载/大并发的网站而言,高性能、轻量级的web server是一剂良药。最近手头一台Server 的负载太高,居然将swap吃光导致机器非常缓慢,后来一查,原来是Apache耗掉了几乎所有资源,当时apache进程已有9XX个了。

于是用轻量级的web server替换掉apache就进入了日程表。这里顺带介绍一下这些可选的对象:
lighttpd | thttpd | shttpd

lighttpd

官方主页:www.lighttpd.net

Lighttpd是一个德国人领导的开源软件,其根本的目的是提供一个专门针对高性能网站,安全、快速、兼容性好并且灵活的web server环境。具有非常低的内存开销,cpu占用率低,效能好,以及丰富的模块等特点。lighttpd是众多OpenSource轻量级的web server中较为优秀的一个。支持FastCGI, CGI, Auth, 输出压缩(output compress), URL重写, Alias等重要功能,而Apache之所以流行,很大程度也是因为功能丰富,在lighttpd上很多功能都有相应的实现了,这点对于apache的用 户是非常重要的,因为迁移到lighttpd就必须面对这些问题。

在google搜索了一下,简体中文介绍lighttpd的文章几乎没有,大多数都是台湾同胞的Big5内容。因此在接下来的时间里,想好好写一篇介绍lighttpd,以及简单的benchmark的文章。

实用起来lighttpd确实非常不错,上文提到的apache overload的问题,用lighttpd就完全解决了。apache主要的问题是密集并发下,不断的fork()和切换,以及较高(相对于 lighttpd而言)的内存占用,使系统的资源几尽枯竭。而lighttpd采用了Multiplex技术,代码经过优化,体积非常小,资源占用很低, 而且反应速度相当快。

利用apache的rewrite技术,将繁重的cgi/fastcgi任务交给lighttpd来完成,充分利用两者的优点,现在那台服务器的负载下降了一个数量级,而且反应速度也提高了一个甚至是2个数量级!

thttpd

官方网站:http://www.acme.com/software/thttpd/
thttpd是一个非常小巧的轻量级web server,它非常非常简单,仅仅提供了HTTP/1.1和简单的CGI支持,在其官方网站上有一个与其他web server(如Apache, Zeus等)的对比图+Benchmark,可以参考参考。此外,thttpd 也类似于lighttpd,对于并发请求不使用fork()来派生子进程处理,而是采用多路复用(Multiplex)技术来实现。因此效能很好。

Thttpd支持多种平台,如FreeBSD, SunOS, Solaris, BSD, Linux, OSF等。对于小型web server而言,速度快似乎是一个代名词,通过官方站提供的Benchmark,可以这样认为:thttpd至少和主流的web server一样快,在高负载下更快,因为其资源占用小的缘故。

Thttpd还有一个较为引人注目的特点:基于URL的文件流量限制,这对于下载的流量控制而言是非常方便的。象Apache就必须使用插件实现,效率较thttpd低。

shttpd

官方网站:http://shttpd.sourceforge.net/ Shttpd是另一个轻量级的web server,具有比thttpd更丰富的功能特性,支持CGI, SSL, cookie, MD5认证, 还能嵌入(embedded)到现有的软件里。最有意思的是不需要配置文件!由于shttpd可以嵌入其他软件,因此可以非常容易的开发嵌入式系统的web server,官方网站上称shttpd如果使用uclibc/dielibc(libc的简化子集)则开销将非常非常低。以下是其特点:

Stand-alone server, or embeddable into existing C/C++ program
GET, POST, PUT, DELETE methods
CGI
SSL
Digest (MD5) authorization
Multiple (and user defineable) index files
Directory listing
Standard logging
Cookies
inetd mode
User-defineable mime types
No configuration files
No external dependencies

由于shttpd可以轻松嵌入其他程序里,因此shttpd是较为理想的web server开发原形,开发人员可以基于shttpd开发出自己的webserver

Categories: Web Server Tags:
  1. June 20th, 2006 at 00:23 | #1

    Thttpd基于URL的文件流量限制,对于下载的流量控制非常方便, 适合构建下载类站点.

  2. June 20th, 2006 at 20:55 | #2

    shttpd是厉害,主程序就一个c文件, 解压后也就几个文件:

    debian:/usr/local# tar zxvf shttpd-1.35.tar.gz
    shttpd-1.35
    shttpd-1.35/embed
    shttpd-1.35/CHANGELOG
    shttpd-1.35/COPYING
    shttpd-1.35/README
    shttpd-1.35/shttpd.1
    shttpd-1.35/shttpd.pem
    shttpd-1.35/shttpd.c
    shttpd-1.35/embed/passfile
    shttpd-1.35/embed/example_nt_service.cpp
    shttpd-1.35/embed/scalable.c
    shttpd-1.35/embed/example.c
    shttpd-1.35/embed/shttpd.h

    # cc -o shttpd shttpd.c -ldl
    # ./shttpd -d /var/www 就可以访问啦,
    http://localhost 能浏览整个目录结构.

  1. No trackbacks yet.






赞助商链接