2012-09-13 32 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 –