lighttpd负载测试和优化

时间:2012-09-13 06:22:33

标签: lighttpd

我最近开始使用lighttpd而不是apache,发现它更实用,更快。

为了让您进一步了解我的配置和其他工具,以实现我的网站上线目的,这里就是。

  1. lighttpd 1.4.31
  2. RAM - 2Gb
  3. max-procs = 2, PHP_FCGI_CHILDREN = 4, PHP_FCGI_MAX_REQUESTS = 10000

    free ram -- 186 free and 652 cached

    问题:

    根据观察,当负载增加到4.00时,网站会出现故障,我不知道为什么会这样。

    当我有足够的内存来服务lighttpd时,我应该如何优化它。

1 个答案:

答案 0 :(得分:1)

这是我的lighttpd配置文件,包含Typo3 + Fastcgi + Fam以及低内存和激进的调整。在我获得我的网络服务器之前,我现在使用Lighttpd而不是Apache来进行我所有的服务器ram(512M)和一些调整我有25M的自由ram并且Typo3运行速度更快。我希望它有帮助吗?

## maximum concurrent connections the server will accept (1/2 of server.max-fds)
server.max-connections = 1024
# Maximum number of file descriptors, default = 1024
server.max-fds = 2048
# Maximum number of request within a keep-alive session before the server terminates the connection, default = 16
server.max-keep-alive-requests = 0
# Maximum number of seconds until an idling keep-alive connection is dropped, default = 5
server.max-keep-alive-idle = 1
# Maximum number of seconds until a waiting, non keep-alive read times out and closes the connection, default = 60
server.max-read-idle = 15
# Maximum number of seconds until a waiting write call times out and closes the connection, default = 360
server.max-write-idle = 15
# Which event handler to use, default = poll
server.event-handler = "linux-sysepoll"
# How to handle network writes, default = writev
server.network-backend = "linux-sendfile"
# Requires FAM or Gamin to be installed, default = simple
server.stat-cache-engine = "fam"
# Whether to update the atime setting on file access, default = disable
server.use-noatime = "enable"
## single client connection bandwidth limit in kilobytes (0=unlimited)
connection.kbytes-per-second = 0
## global server bandwidth limit in kilobytes (0=unlimited)
server.kbytes-per-second = 0
#### expire module
expire.url               = ( "" => "access plus 20 days" )

#### mod_evasive
evasive.max-conns-per-ip = 250

#### limit request method "POST" size in kilobytes (KB)
server.max-request-size  = 1024

#### disable multi range requests
server.range-requests    = "disable"

# selecting modules
server.modules = ( 
                                "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_cml",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
                                "mod_setenv",
                                "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
                                "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
                                "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog",
                "mod_evasive"               
 )

  fastcgi.server = ( ".php" =>
      (( "socket" => "/tmp/php-fastcgi.socket",
          "bin-path" => "/usr/bin/php-cgi",
          "max-procs" => 5,
      "idle-timeout" => 20,
          "bin-environment" => (
              "PHP_FCGI_CHILDREN" => "10",
              "PHP_FCGI_MAX_REQUESTS" => "5000" 
          ),
          "broken-scriptfilename" => "enable" 
      ))
  )