Tagged: lighttpd RSS

  • bixuan 23:49 on 2011 年 03 月 29 日 链接地址 | 回复
    Tags: lighttpd, ,   

    刚做了2个测试:

    1、nginx+php-cgi fpm
    100000 fetches, 100 max parallel, 2e+06 bytes, in 39.5206 seconds
    20 mean bytes/connection
    2530.33 fetches/sec, 50606.6 bytes/sec
    msecs/connect: 0.538099 mean, 3000.11 max, 0.106 min
    msecs/first-response: 38.9175 mean, 402.378 max, 0.313 min
    HTTP response codes:
    code 200 — 100000

    2、lighttpd+php-cgi fpm
    100000 fetches, 100 max parallel, 2e+06 bytes, in 15.6593 seconds
    20 mean bytes/connection
    6385.99 fetches/sec, 127720 bytes/sec
    msecs/connect: 3.78652 mean, 3001.08 max, 0.105 min
    msecs/first-response: 9.88036 mean, 229.16 max, 0.495 min
    HTTP response codes:
    code 200 — 100000

     
  • bixuan 10:38 on 2009 年 06 月 12 日 链接地址 | 回复
    Tags: lighttpd, , , spawn-fcgi, spawn-php.sh   

    spawn-fcgi

    1.概况

    spawn-fcgi官方:http://redmine.lighttpd.net/projects/spawn-fcgi/wiki,可以从这里下载到最新稳定版本。
    lighttpd官方:http://www.lighttpd.net/
    其实spawn-fcgi是lighttpd的一个分支项目,是一个cgi进程的管理器,效率不错。

    2.安装

    1. 下载:
      wget -c http://www.lighttpd.net/download/spawn-fcgi-1.6.2.tar.bz2
      wget -c http://www.lighttpd.net/download/lighttpd-1.4.22.tar.bz2 #(spawn-php.sh这个文件需要从这里提取,具体在:lighttpd-1.4.22/doc/下)
    2. spawn-fcgi安装:
      tar jxvfp spawn-fcgi-1.6.2.tar.bz2
      cd spawn-fcgi-1.6.2
      ./configure
      make
      make install

    3.配置

    这里主要整理spawn-fcgi相关配置!
    安装好后,可以通过:spawn-fcgi -h
    Usage: spawn-fcgi [options] [-- <fcgiapp> [fcgi app arguments]]
    spawn-fcgi v1.6.2 (ipv6) – spawns FastCGI processes
    Options:
    -f <path>      filename of the fcgi-application (ignored if <fcgiapp> is given)
    -d <directory> chdir to directory before spawning
    -a <address>   bind to IPv4/IPv6 address (defaults to 0.0.0.0)
    -p <port>      bind to TCP-port
    -s <path>      bind to Unix domain socket
    -M <mode>      change Unix domain socket mode
    -C <children>  (PHP only) numbers of childs to spawn (default: not setting
    the PHP_FCGI_CHILDREN environment variable – PHP defaults to 0)
    -F <children>  number of children to fork (default 1)
    -P <path>      name of PID-file for spawned process (ignored in no-fork mode)
    -n             no fork (for daemontools)
    -v             show version
    -?, -h         show this help
    (root only)
    -c <directory> chroot to directory
    -S             create socket before chroot() (default is to create the socket in the chroot)
    -u <user>      change to user-id
    -g <group>     change to group-id (default: primary group of user if -u is given)
    -U <user>      change Unix domain socket owner to user-id
    -G <group>     change Unix domain socket group to group-id
    看到详细的参数说明,不过这里为了方便,还是喜欢通过这个spawn-php.sh来管理php-cgi比较方便^_^
    有个地方需要注意:spawn-php.sh这个文件有个bug,见下面红色字体部分:
    # cat spawn-php.sh
    #!/bin/bash
    ## ABSOLUTE path to the spawn-fcgi binary
    SPAWNFCGI=”/usr/local/bin/spawn-fcgi
    ## ABSOLUTE path to the PHP binary
    FCGIPROGRAM=”/app/app/php5-fastcgi/bin/php-cgi
    ## TCP port to which to bind on localhost
    FCGIPORT=”9002″
    ## number of PHP children to spawn
    PHP_FCGI_CHILDREN=10
    ## maximum number of requests a single PHP process can serve before it is restarted
    PHP_FCGI_MAX_REQUESTS=1000
    ## IP addresses from which PHP should access server connections
    FCGI_WEB_SERVER_ADDRS=”192.168.11.159
    pripath=”/app/wwwroot/www.ourlinux.net”
    # allowed environment variables, separated by spaces
    ALLOWED_ENV=”pripath PATH USER”
    ## if this script is run as root, switch to the following user
    USERID=nobody
    GROUPID=nobody
    ################## no config below this line
    if test x$PHP_FCGI_CHILDREN = x; then
    PHP_FCGI_CHILDREN=5
    fi
    export PHP_FCGI_MAX_REQUESTS
    export FCGI_WEB_SERVER_ADDRS
    ALLOWED_ENV=”$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS”
    if test x$UID = x0; then
    EX=”$SPAWNFCGI -a $FCGI_WEB_SERVER_ADDRS -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN”
    else
    EX=”$SPAWNFCGI -a $FCGI_WEB_SERVER_ADDRS -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN”
    fi
    # copy the allowed environment variables
    E=
    for i in $ALLOWED_ENV; do
    E=”$E $i=${!i}”
    done
    # clean the environment and set up a new one
    env – $E $EX
    以上红色部分是要自己补上去,不然默认监听在0.0.0.0,绿色字体部分是要根据具体情况做相应的修改!蓝色字体部分是根据自己的需求加的参数,意思是:php的代码放在pripath这个变量所在的目录下,这个是为了跨机器执行php-cgi,这样可以通过proxy来调用,可以提升cpu利用率(将php-cgi进程跑在cpu消耗低的机器上)

    4.后记

    如果结合lvs,nginx(lighttpd等L7的负载均衡软件)、memcahced等,这样就可以很方便的实现高可用、高性能的分布式系统:)
     
  • bixuan 22:05 on 2008 年 05 月 01 日 链接地址 | 回复
    Tags: , , fpm, lighttpd, , , , web server   

    php-fpm文档中文翻译 

    版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明
    http://syre.blogbus.com/logs/20092011.html

    原文链接:http://php-fpm.anight.org/

    fast-cgi是做啥用的

    FastCGI是一个可伸缩的,高速地在web server和脚本语言间交互的接口。关于FastCGI技术的更多信息可以在官方网站这里看到。

    多数流行的web server都支持FastCGI。包括Apache(mod_fastcgi和mod_fcgid),Zeus,nginx和lighttpd。

    FastCGI的主要优点是把动态语言和web server分离开来。这种技术允许把web server和动态语言运行在不同的主机上,以大规模扩展和改进安全性而不损失生产效率。

    php-fpm可以和任何支持远端FastCGI的web server工作。

    更多见:http://syre.blogbus.com/logs/20092011.html

     
c
写新的
j
下一篇文章/下一个回复
k
前一篇文章/以前的回复
r
回复
e
编辑
o
显示/隐藏 回复
t
回到顶部
l
go to login
h
show/hide help
esc
取消