Webserver Performance Tuning

Apache, Lighttpd, nginx, Cherokee
skyrunner
Posts: 22
Joined: 2003-10-28 14:35

Webserver Performance Tuning

Post by skyrunner » 2006-12-11 12:51

Für zwei Browsergames nutze Ich derzeit folgende Serverumgebung:
- je Browergame 1x Webserver Opteron 165 Dual Core 2GB Ram 2x 2*250 GB Festplatten (RAID1)
- 2x DB- Server MySQL 5 master/slave Opteron 165 Dual Core 2GB Ram 2x 2*250 GB Festplatten (RAID1) Die 2 DB Server teilen sich die beiden Games. Load auf beiden Kisten jeweils unter 3

Mein Flaschenhals ist der zweite Webserver des grafisch aufwändigeren Browsergames. Auf diesem Webserver verwende Ich derzeit folgende Software:

- lighttpd 1.4.13 mit php 4.4.4 als fast-cgi
(lighttpd.conf)

Code: Select all

server.document-root = "/srv/www/vhosts/xxxxx/"
server.port = 80
server.modules = (
                   "mod_fastcgi"
                 )
fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/local/php-4.4.4/sapi/cgi/php",
                     "socket" => "/tmp/php.socket",
                     "max-procs" => 1,
                     "bin-environment" => (
                       "PHP_FCGI_CHILDREN" => "16",
                       "PHP_FCGI_MAX_REQUESTS" => "10000"
                     ),
                     "bin-copy-environment" => (
                       "PATH", "SHELL", "USER"
                     ),
                     "broken-scriptfilename" => "enable"
                 )))
mimetype.assign = (
  ".html" => "text/html",
  ".txt" => "text/plain",
  ".jpg" => "image/jpeg",
  ".png" => "image/png"
)
server.max-keep-alive-requests = 0
server.network-backend = "writev"
server.event-handler = "linux-sysepoll"
server.stat-cache-engine = "fam"

index-file.names = ( "index.php", "index.html", "index.htm" )
Ich habe bereits den Performance- Teil der Lighttpd Doku gelesen und meine conf dahingehend angepasst.

Als OpCode Cache läuft derzeit PECL-APC mit den Standardeinstellungen
(Auszug php.ini)

Code: Select all

extension = apc.so
apc.enabled="1"
apc.shm_segments="1"
apc.shm_size="128"
apc.optimization="0"
apc.num_files_hint="1000"
apc.ttl="3600"
apc.user_ttl="3600"
apc.gc_ttl="3600"
apc.cache_by_default="1"
apc.filters=""
apc.mmap_file_mask="/apc.shm.XXXXXX"
apc.slam_defense="0"
apc.file_update_protection="2"
apc.stat="1"
Das sind die Standard- Einstellungen, wie sie auch bereits hierempfohlen wurden.

Das Problem an der Sache ist, dass beim Aufruf eines Kartenausschnitts (macht der User relativ häufig, klick mich) ca. 100 kleine Gif- Bilder geladen werden müssen. Diese Werden auf der PHP Seite per div Layern übereinander gelegt. Es entsteht also eine sehr große Anzahl an "statischen" Requests, bei denen hauptsächlich Bilder angefordert werden.

Ich hatte in der vorherigen Konfiguration Apache2 prefork mit den Std- Einstellungen sowie PHP5.2 mit Zend Optimizer verwendent. Bei ca. 40 eingeloggten Usern entstand so eine Load von > 100 - ein untragbarer Zustand.

Unter der jetzigen Konfiguration liegt die Load bei ca. 20 gleichzeitigen Benutzern etwa unter 3. Dabei dauert die Seitenauslieferung jedoch extrem Lange, teilweise länger als 7 Sekunden zu Stoßzeiten.

Leider habe Ich gerade keinen Auszug von top zu Stoßzeiten zur Hand. Wie beschrieben lag die Load jedoch unter 3, es wurden 1.4 von 2 GB RAM benutzt. Ich werde euch die Ausgabe von top im Lastzustand heute Abend mal hier rein posten, doch vielleicht hat ja einer schon ne Idee, woran es liegen könnte.

User avatar
daemotron
Administrator
Administrator
Posts: 2635
Joined: 2004-01-21 17:44

Re: Webserver Performance Tuning

Post by daemotron » 2006-12-11 16:52

Hmm, wenn es Zugriffe auf statische Dateien sind, würde ich fast mal auf Disk-Seeks tippen - die Bildchen sind ja nicht wirklich groß, aber der Lesekopf Deiner Platte muss wahrscheinlich ganz schön Karussel fahren... (bildlich gesprochen :wink:)

Idee, wie Du das vielleicht beschleunigen kannst: Laut Deiner Aussage hast Du noch 'n bissl RAM über - da könntest Du Dir ne RAM-Disk anlegen und die Grafik-Dateien reinkopieren und den Webserver von da aus laden lassen. Alternativ mal die Caching-Mechanismen von Lighty unter die Lupe nehmen (CML) und im Memory cachen.

[EDIT]
P. S. irgendwo hier im Forum gab's AFAIR schon mal ne Diskussion zu einem ähnlich gelagerten Thema... ah, got it: http://www.rootforum.org/forum/viewtopic.php?t=41089
Ich verfolge mal die Spur mit der HD-I/O weiter: auf was für einem Dateisystem hast Du die statischen Files denn abgelegt? Welche fam-Implementierung setzt Du ein (famd, gamin)?

skyrunner
Posts: 22
Joined: 2003-10-28 14:35

Re: Webserver Performance Tuning

Post by skyrunner » 2006-12-11 20:19

Hier mal ein Auszug aus Top unter etwas höheren Lastzuständen als heute mittag ;)

Code: Select all

top - 20:18:53 up 7 days,  9:52,  1 user,  load average: 3.83, 4.94, 4.45
Tasks:  48 total,   6 running,  42 sleeping,   0 stopped,   0 zombie
Cpu(s): 96.2% us,  2.9% sy,  0.0% ni,  0.3% id,  0.0% wa,  0.0% hi,  0.6% si
Mem:   2055652k total,  1598520k used,   457132k free,    95720k buffers
Swap:  1020116k total,     3344k used,  1016772k free,  1266192k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
25847 user      16   0  150m  26m  17m R 21.7  1.3   1:51.87 php
25904 user      16   0  149m  18m   9m R 21.4  0.9   1:30.14 php
25871 user      16   0  150m  25m  16m R 20.1  1.3   1:59.51 php
26084 user      16   0  149m  17m 9660 R 19.5  0.9   0:06.83 php
25853 user      15   0  149m  22m  14m S 15.7  1.1   1:51.36 php
23897 root      15   0  9632 2648  696 S  0.3  0.1   0:15.98 lighttpd
    1 root      16   0   724   76   48 S  0.0  0.0   0:02.07 init
    2 root      34  19     0    0    0 S  0.0  0.0   0:00.00 ksoftirqd/0
    3 root      10  -5     0    0    0 S  0.0  0.0   0:00.02 events/0
    4 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 khelper
    9 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
   19 root      19  -5     0    0    0 S  0.0  0.0   0:00.00 kacpid
  101 root      10  -5     0    0    0 S  0.0  0.0   0:00.16 kblockd/0
  146 root      15   0     0    0    0 S  0.0  0.0   0:02.59 pdflush
  147 root      15   0     0    0    0 S  0.0  0.0   0:05.64 pdflush
  149 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 aio/0
  148 root      15   0     0    0    0 S  0.0  0.0   1:30.37 kswapd0
  738 root      17   0     0    0    0 S  0.0  0.0   0:00.00 kseriod
  899 root      11  -5     0    0    0 S  0.0  0.0   0:00.00 ata/0
  915 root      25   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
 1068 root      15   0     0    0    0 S  0.0  0.0   0:58.24 kjournald
 1951 root      12  -4  2552  436  432 S  0.0  0.0   0:00.10 udevd
 2009 root      14  -2  2596  364  364 S  0.0  0.0   0:00.00 hwscand
 2334 root      15   0     0    0    0 S  0.0  0.0   0:00.00 khubd
 3423 root      14  -2  2596  352  352 S  0.0  0.0   0:00.00 hwscand
 4161 root      20   0  3604  412  408 S  0.0  0.0   0:00.00 resmgrd
 4555 root      16   0  2576  508  452 S  0.0  0.0   0:00.02 dhcpcd
 4706 root      15   0  9128  884  684 S  0.0  0.0   0:14.04 syslog-ng
 4709 root      17   0  2816  740  432 S  0.0  0.0   0:00.00 klogd
 4835 root      15   0 15532  736  672 S  0.0  0.0   4:14.13 powersaved
 4871 root      16   0 28624 1456 1252 S  0.0  0.1   0:01.59 sshd
 4891 ntp       16   0 12348 4264 3288 S  0.0  0.2   0:05.40 ntpd
 4905 root      16   0 24172 1096  828 S  0.0  0.1   0:11.31 nscd
 5014 root      15   0 18496 1580 1428 S  0.0  0.1   0:11.24 master
 5036 root      15   0  5908  624  556 S  0.0  0.0   0:06.63 cron
 5040 root      18   0  2992  536  532 S  0.0  0.0   0:00.01 mingetty
 5041 root      15   0  2556  440  436 S  0.0  0.0   0:00.00 agetty
27252 postfix   15   0 17756 2060 1452 S  0.0  0.1   0:01.75 qmgr
22472 root      16   0 39476 2788 2152 R  0.0  0.1   0:00.74 sshd
22479 root      15   0  8864 2228 1440 S  0.0  0.1   0:00.03 bash
23921 user      16   0  141m 1764 1172 S  0.0  0.1   0:00.01 php
23977 root      16   0  4284 1148  868 R  0.0  0.1   0:06.36 top
25050 postfix   16   0 17552 2164 1732 S  0.0  0.1   0:00.04 local
25501 postfix   15   0 17668 2200 1720 S  0.0  0.1   0:00.04 cleanup
25557 postfix   16   0 17552 2164 1732 S  0.0  0.1   0:00.02 local
25558 postfix   16   0 17552 2164 1732 S  0.0  0.1   0:00.01 local
25593 postfix   16   0 17668 2200 1720 S  0.0  0.1   0:00.03 cleanup
25864 postfix   16   0 17480 1816 1416 S  0.0  0.1   0:00.01 pickup

EDIT:
jfreund wrote:auf was für einem Dateisystem hast Du die statischen Files denn abgelegt? Welche fam-Implementierung setzt Du ein (famd, gamin)?
Ich habe eine Standard- Installation, vielleicht kannst Du mir schnell sagen, wie man das fs herausfindet?

Welche fam implementierung ich verwende, kann ich im moment nicht sagen, aus dem Manual vom lighty hab ich das so verstanden, als würden diese funktionen schon vom kernel bereitgestellt. Bin ich da evtl. auf dem Holzweg und der Cache funktioniert im Moment garnicht?

User avatar
Joe User
Project Manager
Project Manager
Posts: 11138
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Webserver Performance Tuning

Post by Joe User » 2006-12-11 20:38

Als Erstes solltest Du ueberfluessige Dienste deaktivieren:
powersaved
acpid
hwscand
ntpd

Danach solltest Du einen zu Deinem System passenden Kernel kompilieren und alle weiteren unnoetigen Pakete deinstallieren. Desweiteren hilft uns "Standard-Installation" nicht weiter, da es keine "Standard-Installation" gibt. Das Filesystem ermittelst Du per "mount" und ob Du famd oder gamin installiert hast, veraet Dir das Paketmanagment Deiner Distribution.

Poste bitte mal Deine vollstaendige kommentarfreie lighttpd.conf und php.ini.
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

skyrunner
Posts: 22
Joined: 2003-10-28 14:35

Re: Webserver Performance Tuning

Post by skyrunner » 2006-12-12 12:29

Mein Filesystem ist ext3
Laut yast habe ich weder famd noch gamind installiert.

lighttpd.conf

Code: Select all

server.document-root = "/srv/www/vhosts/warfare1942/"

server.port = 80
server.tag = "Apache"

server.modules = (
                   "mod_fastcgi"
                 )

fastcgi.server = ( ".php" =>
                       (
                          ( "socket" => "/srv/www/vhosts/fastcgi/php4.socket",
                            "check-local" => "disable",
                            "broken-scriptfilename" => "enable",
                            "max-procs" => 1,
                            "bin-environment" => (
                                "PHP_FCGI_CHILDREN" => "16",
                                "PHP_FCGI_MAX_REQUESTS" => "10000"
                            )
                          )
                        )
                      )

mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",  
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
 )

server.max-keep-alive-requests = 0
server.network-backend = "writev"
server.event-handler = "linux-sysepoll"
server.stat-cache-engine = "fam"


index-file.names = ( "index.php", "index.html", "index.htm" )
php.ini

Code: Select all

[PHP]
engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision    =  14
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
disable_classes =
expose_php = On
max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 256M      ; Maximum amount of memory a script may consume (8MB)
error_reporting  =  E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = "GPCS"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
post_max_size = 8M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
extension_dir = /usr/lib64/extensions/no-debug-non-zts-20020429
enable_dl = On
file_uploads = On
upload_max_filesize = 2M
allow_url_fopen = On
default_socket_timeout = 60
define_syslog_variables  = Off
SMTP = localhost
smtp_port = 25
sql.safe_mode = Off
odbc.allow_persistent = Off
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_password =
mysqli.reconnect = Off
msql.allow_persistent = Off
msql.max_persistent = -1
msql.max_links = -1
pgsql.allow_persistent = Off
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
sybase.allow_persistent = Off
sybase.max_persistent = -1
sybase.max_links = -1
sybase.min_error_severity = 10
sybase.min_message_severity = 10
sybase.compatability_mode = Off
sybct.allow_persistent = Off
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
dbx.colnames_case = "lowercase"
bcmath.scale = 0
ifx.default_host =
ifx.default_user =
ifx.default_password =
ifx.allow_persistent = Off
ifx.max_persistent = -1
ifx.max_links = -1
ifx.textasvarchar = 0
ifx.byteasvarchar = 0
ifx.charasvarchar = 0
ifx.blobinfile = 0
ifx.nullformat = 0
session.save_handler = files
session.save_path = "/tmp"
session.use_cookies = 1
session.name = SSID
session.auto_start = 1
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor     = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
mssql.allow_persistent = Off
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
ingres.allow_persistent = Off
ingres.max_persistent = -1
ingres.max_links = -1
ingres.default_database =
ingres.default_user =
ingres.default_password =
pfpro.defaulthost = "test-payflow.verisign.com"
pfpro.defaultport = 443
pfpro.defaulttimeout = 30
sockets.use_system_read = On
tidy.clean_output = Off
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400

cgi.fix_pathinfo = 1

extension = apc.so
apc.enabled="1"
apc.shm_segments="1"
apc.shm_size="128"
apc.optimization="0"
apc.num_files_hint="1000"
apc.ttl="3600"
apc.user_ttl="3600"
apc.gc_ttl="3600"
apc.cache_by_default="1"
apc.filters=""
apc.mmap_file_mask="/apc.shm.XXXXXX"
apc.slam_defense="0"
apc.file_update_protection="2"
apc.stat="1"

User avatar
Joe User
Project Manager
Project Manager
Posts: 11138
Joined: 2003-02-27 01:00
Location: Hamburg

Re: Webserver Performance Tuning

Post by Joe User » 2006-12-12 13:12

Versuche es mal mit folgender lighttpd.conf (server.name anpassen und Pfade kontrollieren):

Code: Select all

server.username = "lighttpd"
server.groupname = "lighttpd"
server.stat-cache-engine = "fam"
server.event-handler = "linux-sysepoll"
server.pid-file = "/var/run/lighttpd.pid"
server.errorlog = "/var/log/lighttpd/error_log"
server.document-root = "/srv/www/vhosts/warfare1942"
server.name = "hostname.domain.tld"
server.follow-symlink = "enable"
server.max-keep-alive-idle = 10
server.max-fds = 2048
server.modules = (
    "mod_rewrite",
    "mod_redirect",
    "mod_alias",
    "mod_access",
    "mod_auth",
    "mod_setenv",
    "mod_expire",
    "mod_fastcgi",
    "mod_cgi",
    "mod_ssi",
    "mod_compress",
    "mod_evasive",
    "mod_accesslog",
)
server.indexfiles = (
    "index.xhtml",
    "index.html",
    "index.htm",
    "index.php",
)
mimetype.assign = (
    ".pdf"     => "application/pdf",
    ".sig"     => "application/pgp-signature",
    ".spl"     => "application/futuresplash",
    ".class"   => "application/octet-stream",
    ".ps"      => "application/postscript",
    ".torrent" => "application/x-bittorrent",
    ".dvi"     => "application/x-dvi",
    ".pac"     => "application/x-ns-proxy-autoconfig",
    ".swf"     => "application/x-shockwave-flash",
    ".tgz"     => "application/x-tgz",
    ".mp3"     => "audio/mpeg",
    ".m3u"     => "audio/x-mpegurl",
    ".wma"     => "audio/x-ms-wma",
    ".wax"     => "audio/x-ms-wax",
    ".ogg"     => "application/ogg",
    ".wav"     => "audio/x-wav",
    ".xbm"     => "image/x-xbitmap",
    ".xpm"     => "image/x-xpixmap",
    ".xwd"     => "image/x-xwindowdump",
    ".asc"     => "text/plain",
    ".c"       => "text/plain",
    ".h"       => "text/plain",
    ".cc"      => "text/plain",
    ".cpp"     => "text/plain",
    ".hh"      => "text/plain",
    ".hpp"     => "text/plain",
    ".conf"    => "text/plain",
    ".log"     => "text/plain",
    ".text"    => "text/plain",
    ".txt"     => "text/plain",
    ".diff"    => "text/plain",
    ".patch"   => "text/plain",
    ".ebuild"  => "text/plain",
    ".eclass"  => "text/plain",
    ".rtf"     => "application/rtf",
    ".bmp"     => "image/bmp",
    ".tif"     => "image/tiff",
    ".tiff"    => "image/tiff",
    ".ico"     => "image/x-icon",
    ".mpeg"    => "video/mpeg",
    ".mpg"     => "video/mpeg",
    ".mov"     => "video/quicktime",
    ".qt"      => "video/quicktime",
    ".avi"     => "video/x-msvideo",
    ".asf"     => "video/x-ms-asf",
    ".asx"     => "video/x-ms-asf",
    ".wmv"     => "video/x-ms-wmv",
    ".tbz"     => "application/x-bzip-compressed-tar",
    ".tar.bz2" => "application/x-bzip-compressed-tar",
    ".tar.gz"  => "application/x-tgz",
    ".bz2"     => "application/x-bzip",
    ".gz"      => "application/x-gzip",
    ".tar"     => "application/x-tar",
    ".zip"     => "application/zip",
    ".jpeg"    => "image/jpeg",
    ".jpg"     => "image/jpeg",
    ".png"     => "image/png",
    ".gif"     => "image/gif",
    ".xhtml"   => "text/html",
    ".html"    => "text/html",
    ".htm"     => "text/html",
    ".dtd"     => "text/xml",
    ".xml"     => "text/xml",
    ".css"     => "text/css",
    ".js"      => "text/javascript",
    ".php"     => "application/x-httpd-php",
    ""         => "text/plain",
)
static-file.exclude-extensions = (
    ".pl",
    ".cgi",
    ".fcgi",
    ".php",
)
dir-listing.activate = "disable"
dir-listing.hide-dotfiles = "enable"
dir-listing.encoding = "utf-8"
dir-listing.exclude = (
    "^.",
    "~$",
    "favicon.ico",
    "robots.txt",
)
url.access-deny = (
    "~",
    ".ini",
    ".inc",
    ".cfg",
    ".tpl",
    ".bak",
    ".dist",
    ".orig",
    ".htaccess",
    ".htpasswd",
    ".example",
    ".sample",
    ".lang",
)
fastcgi.server = (
    ".php" => (
        (
            "bin-path" => "/usr/local/php-4.4.4/sapi/cgi/php",
            "socket" => "/srv/www/vhosts/fastcgi/php4.socket",
            "min-procs" => 2,
            "max-procs" => 2,
            "bin-environment" => (
                "PHP_FCGI_CHILDREN" => "4",
                "PHP_FCGI_MAX_REQUESTS" => "250",
            ),
            "bin-copy-environment" => (
                "PATH",
                "SHELL",
                "USER",
            ),
            "broken-scriptfilename" => "enable",
        ),
    ),
)
cgi.assign = (
    ".pl" => "/usr/bin/perl",
    ".cgi" => "/usr/bin/perl",
)
ssi.extension = (
    ".shtml",
)
compress.filetype = (
    "text/javascript",
    "text/plain",
    "text/html",
    "text/css",
    "text/xml",
)
$HTTP["url"] =~ ".pdf$" {
    server.range-requests = "disable"
}
evasive.max-conns-per-ip = 4
accesslog.filename = "/var/log/lighttpd/access_log"
accesslog.format = "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
Mit einer php.ini für PHP4 kann ich nicht dienen, aber die für PHP5 sollte weitestgehend kompatibel sein (Pfade anpassen):

Code: Select all

[PHP]
engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision = 14
y2k_compliance = On
output_buffering = On
output_handler =
zlib.output_compression = On
zlib.output_compression_level = -1
zlib.output_handler =
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 100
allow_call_time_pass_reference = Off
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
open_basedir =
disable_functions = system,shell_exec,popen,pclose,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,exec,passthru,show_source,readfile,escapeshellcmd,escapeshellarg
disable_classes =
highlight.string = #DD0000
highlight.comment = #FF9900
highlight.keyword = #007700
highlight.bg = #FFFFFF
highlight.default = #0000BB
highlight.html = #000000
ignore_user_abort = Off
realpath_cache_size = 16k
realpath_cache_ttl = 120
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 32M
error_reporting = E_ALL & ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
report_zend_debug = 0
track_errors = Off
html_errors = Off
error_log = "/var/log/lighttpd/phperr_log"
arg_separator.output = "&"
arg_separator.input = ";&"
variables_order = "GPCS"
register_globals = Off
register_long_arrays = Off
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
magic_quotes_gpc = On
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
always_populate_raw_post_data = Off
include_path = ".:/usr/share/php5:/usr/share/php"
doc_root =
user_dir =
enable_dl = On
file_uploads = On
upload_tmp_dir =
upload_max_filesize = 2M
cgi.fix_pathinfo = 1
allow_url_fopen = On
allow_url_include = Off
from = "anonymous@localhost"
user_agent = ""
default_socket_timeout = 60
auto_detect_line_endings = Off

[Syslog]
define_syslog_variables  = Off

[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = "/usr/bin/sendmail -t -i"
mail.force_extra_parameters =

[SQL]
sql.safe_mode = Off

[MySQL]
mysql.allow_persistent = Off
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off

[MySQLi]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off

[PostgresSQL]
pgsql.allow_persistent = Off
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

[bcmath]
bcmath.scale = 0

[Session]
session.save_handler = files
session.save_path = "/dev/shm"
session.use_cookies = 1
session.cookie_secure =
session.use_only_cookies = 0
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = "/"
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 16
session.entropy_file = "/dev/urandom"
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,fieldset="

[Assertion]
assert.active = On
assert.warning = On
assert.bail = Off
assert.callback = 0
assert.quiet_eval = 0

[soap]
soap.wsdl_cache_enabled = 1
soap.wsdl_cache_dir = "/tmp"
soap.wsdl_cache_ttl = 86400

extension = apc.so
apc.enabled = "1"
apc.shm_segments = "1"
apc.shm_size = "128"
apc.optimization = "0"
apc.num_files_hint = "1000"
apc.ttl = "3600"
apc.user_ttl = "3600"
apc.gc_ttl = "3600"
apc.cache_by_default = "1"
apc.filters = ""
apc.mmap_file_mask = "/apc.shm.XXXXXX"
apc.slam_defense = "0"
apc.file_update_protection = "2"
apc.stat = "1"
Backups nicht vergessen!

HTH
PayPal.Me/JoeUserFreeBSD Remote Installation
Wings for LifeWings for Life World Run

„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.

stanglwirt
Posts: 48
Joined: 2006-01-10 14:44

Re: Webserver Performance Tuning

Post by stanglwirt » 2006-12-13 08:47

solltest vielleicht auch ein tuning der anwendung selbst in betracht ziehen.

eventuell kann es besser sein, ein großes bild von php generieren zu lassen und das dann komplett auszuliefern statt 100 bildchen zu verschicken, was mir auf den ersten blick nicht so optimal aussieht...