Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Apache, Lighttpd, nginx, Cherokee
Post Reply
Anonymous
 

Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

Seit einigen Wochen beobachte ich seltsames.

Der Apache2 schaufelt regelmäßig das Swapfile zu. Das System wird damit so lahm, das die Kiste fast stehen bleibt.

Mal nen Auszug der Prozesse ...

Code: Select all

top - 20:04:28 up  2:10,  3 users,  load average: 8.68, 9.08, 12.56
Tasks: 351 total,  10 running, 340 sleeping,   0 stopped,   1 zombie
Cpu(s):  73.8% user,  13.1% system,   0.0% nice,  13.1% idle
Mem:   1025160k total,  1013076k used,    12084k free,     1008k buffers
Swap:  2048276k total,   110952k used,  1937324k free,   216672k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
20724 wwwrun    17   0 11676  11m 7788 S  9.0  1.1   0:01.09 httpd2-prefork
20754 wwwrun    13   0 12176  11m 7804 R  7.9  1.2   0:02.83 httpd2-prefork
21126 wwwrun    13   0 11832  11m 7812 S  4.9  1.2   0:02.47 httpd2-prefork
22874 wwwrun    13   0 11852  11m 7788 S  4.6  1.2   0:00.72 httpd2-prefork
20789 wwwrun     9   0 12064  11m 7804 S  3.8  1.2   0:01.79 httpd2-prefork
20966 wwwrun     9   0 11704  11m 7788 S  3.3  1.1   0:03.11 httpd2-prefork
21294 wwwrun     9   0 13316  13m 7800 S  3.3  1.3   0:03.18 httpd2-prefork
 8507 root      12   0  1236 1172  816 R  3.0  0.1   0:49.96 top
21131 wwwrun    19   0 11136  10m 7772 R  2.7  1.1   0:00.29 httpd2-prefork
22875 wwwrun    15   0 10860  10m 7764 S  2.7  1.1   0:00.66 httpd2-prefork
20833 wwwrun    10   0 10780  10m 7780 S  2.4  1.1   0:00.45 httpd2-prefork
21203 wwwrun     9   0 11492  11m 7792 S  2.4  1.1   0:01.76 httpd2-prefork
20866 wwwrun     9   0 10884  10m 7760 S  2.2  1.1   0:00.43 httpd2-prefork
20822 wwwrun     9   0 10820  10m 7768 S  1.9  1.1   0:00.75 httpd2-prefork
21666 wwwrun    16   0 11780  11m 7804 S  1.9  1.1   0:01.26 httpd2-prefork
21114 wwwrun    13   0  9024 9020 7840 S  1.4  0.9   0:00.34 httpd2-prefork

Code: Select all

<IfModule prefork.c>
        # number of server processes to start
        StartServers         5
        # minimum number of server processes which are kept spare
        MinSpareServers     15
        # maximum number of server processes which are kept spare
        MaxSpareServers     20
        # maximum number of server processes allowed to start
        MaxClients       250
        # maximum number of requests a server process serves
        #MaxRequestsPerChild  0
        # set to 1 because of a bug in php - this will slow down the server
        MaxRequestsPerChild 100
</IfModule>
Ich denk mal das hier das Problem liegt.
Mit Apache 1.3.x hab ich nie Probleme gehabt. Aber der zweier der nervt und ist das beschissenste Teil seiner Generation aus meiner Sicht.

Seltsam an der Sache, Bilder, egal wie klein die sind, brauchen oft Ewigkeiten, ehe sie geladen sind.

Seite läuft mit PHP 4.3.8 plus Zend Optimizer


An was liegts?
Denn ich denke mal das 10 bis 11 MB Speicher für den Apache zu viel sind .. oder?! Brauchts noch mehr Info um dem Grund auf die Spur zu kommen?!
Last edited by Anonymous on 2004-09-10 20:55, edited 1 time in total.
tomek
Posts: 243
Joined: 2003-08-05 09:44
Location: Paderborn
Contact:
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by tomek »

10-11 MB pro httpd Prozess ist in Ordnung. Apache2 ist prinzipiell nicht "scheisse".

Du hast einfach viele httpd-Prozesse weil viel los ist und du MaxClients 250 eingestellt hast. D.h. 250 httpd-Prozesse.

Ich würde bei dir auf jeden Fall erstmal die MaxRequestsPerChild erhöhen:

Code: Select all

MaxRequestsPerChild 10000
Wie sehen deine KeepAlive-Settings in der Apache-Config aus? Auch würde ich persistente Verbindungen zu MySQL bei PHP deaktivieren, falls noch nicht geschehen.
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

Ne Menge ist los, jedoch sollte das bei ca. 100 Usern gleichzeitig nicht solche Dimensionen annehmen. Oder?!

Keep Alive ..

MaxKeepAliveRequests 150
Timeout ist bei 120

Persistente Datenbank ist deaktiviert, sprich off

MaxRequestsperChield hatte ich bisher auf 1000, habs gestern mal runtergenommen, deshalb da die 100. Probleme die selben. Hab es jetzt mal auf 10.000 (natürlich ohne Punkt stehen ;o))

PS:
ist ne Intel(R) Pentium(R) 4 CPU 2.66GHz
Jedoch mit Original Kernl, da ich bisher noch nie Glück mit einem selbstgebackenem hatte. Meist war der größer oder hupte rum.
Kernl-Version: 2.4.25-040218 (SMP)
tomek
Posts: 243
Joined: 2003-08-05 09:44
Location: Paderborn
Contact:
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by tomek »

Setze mal folgendes:

Code: Select all

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
Was ich vielleicht noch versuchen würde, ist einen Umstieg auf Linux Kernel 2.6.
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

So .. ne Woche lang getestet ....

Das Problem besteht irgendwie immer noch.

Ab und an ist es sogar so, das der Apache seine Prozesse nicht beendet, 500 und mehr Tasks laufen und der Server förmlich stehen bleibt.

Er schaufelt dann in 3-4 Minuten ca. 500 MB Swapfile zusammen, Prozessorleistung marschiert gen Null, Traffic ebenso. Load liegt dann bei 32 bis 38. Machen tut die Kiste jedoch nix mehr, zumindest nicht mehr viel.

Mit den hier geratenen Ã?nderungen an der Config hab ich nun res. Speicher des Apache2 zwischen 8,5 bis 13 MB. Genutzter Speicher um die 5,5 MB

Neustart Apache und das Problem ist behoben ....
Irgendwie hatte ich das mit dem Apache1 nicht solche Sachen ....
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

Wieder das selbe Spiel ....

Load geht nach oben, Prozessor Last nach unten, Traffic ebenso ...
Swap schaufelt sich bis 600 MB zu ...

Apache hat dann das hier:

Code: Select all

4607 wwwrun    10   0 93708  38m 4016 S  1.6  3.8   0:14.37 httpd2-prefork
 4194 wwwrun    10   0 52504  25m 4376 S  1.5  2.6   0:07.16 httpd2-prefork
 4149 wwwrun     9   0 59164  28m 4372 S  1.4  2.8   0:09.68 httpd2-prefork
 4547 wwwrun    10   0 58972  31m 3976 S  1.4  3.2   0:05.39 httpd2-prefork
 4493 wwwrun     9   0 56904  30m 3964 S  1.4  3.0   0:04.85 httpd2-prefork
 4605 wwwrun    10   0 53192  31m 4016 S  1.4  3.1   0:04.35 httpd2-prefork
 4659 wwwrun     9   0 54272  25m 3900 S  1.4  2.6   0:04.57 httpd2-prefork
 4227 wwwrun     9   0 58044  28m 4400 S  1.3  2.8   0:08.43 httpd2-prefork
 4426 wwwrun     9   0 34680  32m 4620 S  1.3  3.2   0:04.12 httpd2-prefork
 4464 wwwrun    10   0 56980  28m 4336 S  1.3  2.9   0:06.54 httpd2-prefork
 4482 wwwrun     9   0 57996  29m 4280 S  1.3  3.0   0:05.03 httpd2-prefork
 4613 wwwrun     9   0  9668 7932 5920 S  1.3  0.8   0:02.02 httpd2-prefork
Was zum Geier macht der hier?!
Ich dachte iegntlich bisher dasich mit Apache klar komme. Aber wenn ich das hier sehe .... ich bin mit meinem Latein am Ende ...
captaincrunch
Userprojekt
Userprojekt
Posts: 7066
Joined: 2002-10-09 14:30
Location: Dorsten
Contact:
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by captaincrunch »

Apache selbst kompiliert? Rück mal nähere Angaben zum System raus.
DebianHowTo
echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

Wie oben schon geschrieben.
Ist der Original Apache der in der SuSE 9.0 Distribution drinnen ist.

Einzig PHP ist neu kompiliert worden.

Zusammenfassend nochmal die System Info:

PHP 4.3.8
SuSE 9.0
Kernel: 2.4.25-040218 (SMP)
Intel P4 CPU mit 2600MHz
Platte: hda - ST380011A

Speicher 1GB
SwapFile: 1,95 GB

Einstellung Platte mit: hdparm -c3 -d1 -m16 -u1 -X69 /dev/hda

hmm.. brauchts noch mehr?!

Ach ja, Traffic gehen pro Monat um die 220 GB weg ....
Durchschnittliche Prozessorlast am Tag mit 48%, die Woche mit 45%
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

OK, ich hab mich nun dazu entschlossen den Apachen neu zu bauen.

Apache2 Worker, da ja viele der Meinung sind er wäre performater bei viel Systemlast.

Also lade ich die neueste Version bei Apache org und komiliere mit folgenden Flags:

Code: Select all

./configure --with-mpm=worker 
--enable-modules="so http" 
--enable-mods-shared="info status cern_meta usertrack asis include autoindex cgid imap deflate alias auth auth_anon auth_digest access cache mem_cache file-cache cgi dir env ext_filter expires headers file_cache log_config mime mime_magic negotiation rewrite speling actions userdir setenvif" 
--prefix=/usr/local/yno-apache
--enable-static-support 
--sysconfdir=/etc/apache-yno 

Es soll ein zweiter Apache werden, der ne völlig andere Konfiguration haben soll, weil der ursprüngliche mit Confixx funktionieren soll. Und da Confixx laufend irgendwelche willenlosen Ã?nderungen in der httpd.conf macht, halt eben so.

make, make install, start des Indianers Perfekt, es läuft.

Nun PHP .. und das wird so ne Sache. Wird so kopiliert:

Code: Select all

./configure 
--prefix=/usr/share 
--datadir=/usr/share/php 
--bindir=/usr/bin 
--libdir=/usr/share 
--includedir=/usr/include 
--sysconfdir=/etc 
--with-_lib=lib 
--with-config-file-path=/etc 
--with-exec-dir=/usr/lib/php/bin 
--disable-debug 
--enable-bcmath 
--enable-calendar 
--enable-ctype 
--enable-discard-path 
--enable-exif 
--enable-filepro 
--enable-force-cgi-redirect 
--enable-ftp 
--enable-gd-imgstrttf 
--enable-gd-native-ttf 
--enable-inline-optimization 
--enable-magic-quotes 
--enable-mbstr-enc-trans 
--enable-mbstring 
--enable-mbregex 
--enable-memory-limit 
--enable-safe-mode 
--enable-shmop 
--enable-sigchild 
--enable-sysvsem 
--enable-sysvshm 
--enable-track-vars 
--enable-trans-sid 
--enable-versioning 
--enable-wddx 
--enable-yp 
--with-bz2 
--with-dom=/usr/include/libxml2
--with-ftp 
--with-gettext 
--with-gmp 
--with-imap=yes 
--with-iodbc 
--with-jpeg-dir=/usr 
--with-ldap=yes 
--with-mcal=/usr 
--with-mcrypt 
--with-mhash 
--with-mysql=/usr 
--with-pgsql=/usr 
--with-png-dir=/usr 
--with-readline 
--with-snmp 
--with-t1lib 
--with-tiff-dir=/usr 
--with-ttf 
--with-freetype-dir=yes 
--with-xml 
--with-zlib=yes 
--with-gd 
--with-openssl 
--with-curl 
--with-imap-ssl 
--enable-xslt 
--with-xslt-sablot 
--with-iconv  
--with-exec-dir=/usr/local/yno-apache/libexec  
--with-axps2=/usr/local/yno-apache/bin/axps  
--with-cpdflib=/usr/local/include 
i586-suse-linux
make macht er ohne Probleme, hupt nirgends rum.

Dabei raus kommt während make install das:

Code: Select all

Installing PHP SAPI module:       cgi
Installing PHP CGI into: /usr/bin/
Installing PEAR environment:      /usr/share/php/
[PEAR] Archive_Tar    - already installed: 1.1
[PEAR] Console_Getopt - already installed: 1.2
[PEAR] PEAR           - already installed: 1.3.2
Wrote PEAR system config file at: /etc/pear.conf
You may want to add: /usr/share/php to your php.ini include_path
[PEAR] DB             - already installed: 1.6.2
[PEAR] HTTP           - already installed: 1.2.2
[PEAR] Mail           - already installed: 1.1.3
[PEAR] Net_SMTP       - already installed: 1.2.3
[PEAR] Net_Socket     - already installed: 1.0.1
[PEAR] XML_Parser     - already installed: 1.0.1
[PEAR] XML_RPC        - already installed: 1.1.0
Installing build environment:     /usr/share/lib/php/build/
Installing header files:          /usr/include/php/
Installing helper programs:       /usr/bin/
  program: phpize
  program: php-config
  program: phpextdist
Ich bekomme keine libphp4.so
Nix zu finden, auf dem ganzen Server nicht. (Zumindest keine der neuen Generation)

Zur Configuration in der httpd.conf:

Code: Select all

--> Block1
#ScriptAlias /php4/ "/usr/bin/php"
#AddType application/x-httpd-php4 .phtml
#AddType application/x-httpd-php4 .php3
#AddType application/x-httpd-php4 .php4
#AddType application/x-httpd-php4 .php
#AddType application/x-httpd-php4-source .phps
#Action application/x-httpd-php4 /


-->Block2
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php .phtml

-->Block3
#<IfModule sapi_apache2.c>
#        AddType application/x-httpd-php .php
#        AddType application/x-httpd-php .php3
#        AddType application/x-httpd-php .php4
#        AddType application/x-httpd-php-source .phps
#        DirectoryIndex index.php
#        DirectoryIndex index.php3
#        DirectoryIndex index.php4
#</IfModule>
Alles mögliche versucht, auch hier keine Chance.
Einzig das als "Block1" bezeichnete Stück bringt schon mal eine Fehlermeldung des PHP,

Code: Select all

[Fri Sep 10 17:27:32 2004] [error] [client 217.225.227.177] Request exceeded the limit of 10 internal redirects due to proba$
mit der ich jedoch nicht wirklich viel anfangen kann.

Block2 und 3 nutzen ja nun nicht wirklich etwas, wenn die libphp.so nicht vorhanden ist.

Also ich hab nun alles mögliche an Doku gewälzt. Hier im Forum rumgesucht ....

Also ich bin mit meinem Latein erst mal am Ende ... *seufz*

Irgendwer von Euch ne Idee wo mein Fehler liegt?!
oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by oxygen »

Wenn du es nicht schaffst selbst einen Apache zu bauen, benutzt halt die Distributionspakete. Die von SuSE sind wirklich gut und aktuelle sind auch für ältere Distributionen immer verfügbar.
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

øxygen wrote:Wenn du es nicht schaffst selbst einen Apache zu bauen, benutzt halt die Distributionspakete. Die von SuSE sind wirklich gut und aktuelle sind auch für ältere Distributionen immer verfügbar.
Wenn ich das gewollt hätte, würde ichs auch machen ;o)
Problem an der Sache, Geht was nicht so wie ich es will, sind immer "die anderen" schuld ;o)

Ich will wissen was passiert und die Serversoftware soweit anpassen, das ich das habe was ich auch brauche. Es ist ne Kiste die eh schon viel zu tun hat. Deshalb ja ;o)
User avatar
Joe User
Project Manager
Project Manager
Posts: 11191
Joined: 2003-02-27 01:00
Location: Hamburg
Contact:
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Joe User »

Du hast PHP-CGI kompiliert, nicht mod_php...
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.
oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by oxygen »

Oberwaldforsthorst wrote: Ich will wissen was passiert und die Serversoftware soweit anpassen, das ich das habe was ich auch brauche. Es ist ne Kiste die eh schon viel zu tun hat. Deshalb ja ;o)
Einfach die ./configure Zeile aus einem anderem Paket (dem falschen btw) übernehmen klingt für mich nicht nach anpassen.
Anonymous
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by Anonymous »

Joe User wrote:Du hast PHP-CGI kompiliert, nicht mod_php...
*patsch*

Genau das wars ;o)

Wenn jetzt alles läuft, dann poste ich mal die Konfiguration.


Danke

@øxygen, nix mit "aus anderem Paket". Auch wenn das ein oder andere als "Idee" ganz sicher mit eingeflossen ist. Und wenn es auch so wäre wie Du behauptet, lernen ist am Ende ja das oberste Ziel, oder?!


Mirko
oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim
 

Re: Apache2 schaufelt Swap-File zu .. (nun Neuinstallation Prob)

Post by oxygen »

Oberwaldforsthorst wrote: @øxygen, nix mit "aus anderem Paket". Auch wenn das ein oder andere als "Idee" ganz sicher mit eingeflossen ist. Und wenn es auch so wäre wie Du behauptet, lernen ist am Ende ja das oberste Ziel, oder?!
Nagut, wenn du abgeschreiben als Idee übernehmen definierst, mag das stimmen. Wenn du dich fragst woher ich das wohl weiß, in der Zeile sind mehrere Fehler enthalten, die du mit abgeschrieben hast.
Natürlich hast du recht, lernen ist das oberste Ziel. Aber wenns geht, nicht in der produktiven Umgebung auf einem RootServer. Eine Apache kann man sehr gut zu Hause oder am Arbeitsplatz in einer Testumgebung kompilieren und testen.
Post Reply