2012-09-13 31 views
1

我最近开始使用lighttpd而不是apache,并发现它更加实用和快速。lighttpd负载测试和优化

为了让我更进一步了解我的配置和其他工具,以便我的网站在线上的目的,在这里他们是。

  1. lighttpd的1.4.31
  2. RAM - 2Gb的

max-procs = 2, PHP_FCGI_CHILDREN = 4, PHP_FCGI_MAX_REQUESTS = 10000

free ram -- 186 free and 652 cached

问题:

根据观察,每当负载增加到4.00站点下降,我不知道为什么发生这样。

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

回答

1

这是我的lighttpd配置文件Typo3 + Fastcgi + Fam和低内存和积极调优。在我的web服务器使用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" 
    )) 
) 
+0

感谢分享配置,我根据你的配置做了必要的修改,但是一旦负载达到了4.00 lighttpd restart,虽然我有监视器来完成我的工作。 –

+0

@JyotirBhandari当负载达到4.0时,monit是否会重启lighttpd? – j0k

+0

是的,当负载是4.00时,有index.php文件,我每隔1分钟由monit调用一次,如果它没有被获取,那么monit重新启动lighty,并且根据观察,负载通常是4.00 –