Jyotir Bhandari
Jyotir Bhandari

Reputation: 109

lighttpd load testing and optimization

I have recently started using lighttpd instead of apache and found it more usable and fast.

To let you know further my configuration and other tools to serve my purpose for site to be online, here they are.

  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

Issue :

As per the observation whenever load increase upto 4.00 the site goes down, i dont know why it happening so.

How should i optimize it when i got ample memory to serve lighttpd.

Upvotes: 1

Views: 5021

Answers (1)

Cybercartel
Cybercartel

Reputation: 12582

This is my lighttpd config file with Typo3 + Fastcgi + Fam and low memory and aggressive tuning. Before I got my webserver eats all my server ram (512M) now with Lighttpd instead of Apache and some tuning I have 25M free ram and Typo3 is running a magnitude faster. I hope it helps?

## 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" 
      ))
  )

Upvotes: 1

Related Questions