"We are back" « oc.at

Artikel zu Apache Tuning gesucht

Rektal 27.05.2004 - 00:33 746 8
Posts

Rektal

Here to stay
Registered: Dec 2002
Location: Inside
Posts: 4477
Kenn jemand in-depth Artikel fuer Apache-Tuning?

Rektal

Here to stay
Registered: Dec 2002
Location: Inside
Posts: 4477
Vielleicht sollte ich spezifischer sein. Ich meine Artikel, die ueber die ueblichen verdaechtigen (Timeout, MaxSpareServers, MaxSpareServers, MaxClients, MaxRequestsPerChild) hinausgehen, ohne jetzt aber zu hardcore zu werden und custom-patches einzuspielen.

funka

Legend
ex-prophet(down below)
Registered: Sep 2000
Location: Vienna / SF
Posts: 6131
in depth ist der zwar weniger aber mal der erste den ich auf die schnelle in meinen bookmarks finden konnte
http://www.onlamp.com/pub/a/onlamp/...amp_tuning.html

edit: falls es wenn interessiert:
MaxClients
Apache, when it starts up creates a number of HTTPD processes to handle requests for web pages. The creation and deletion of these are controlled by the root httpd process and are dependent on the load on the web server and other parameters in httpd.conf.

MaxClients sets the hard limit on the number of httpd processes that a machine can create. This is to stop a heavily loaded web server from consuming more and more resources from the host machine and gives you a worst case scenario of the appetite of your machine's web server. The default value is 150

MaxRequestsPerChild
When there are more requests than processes the server will spawn new child processes to handle the requests (assuming, of course the hard limit of MaxClients has not been reached). In the normal course of events, a child process handles a number of requests and then dies. If this value is set to 0 it means the child never dies.

Having child processes that never die will reduce child process creation overhead but if the process never dies and there are memory leaks then these leaks will continue until the web server is rebooted. It should be noted that there are no known leaks with apache 1.3 but the re might be some in system libraries. The default value for this is 30

MinSpareServers
You can set the minimum number of child processes that should be running also. If fewer of these processes are running then new processes are created until this number is reached. Do NOT have this number higher than MaxSpareServers. Setting this too high and you will be wasting resources unnecessarily. Too low and you will be using a lot of resources to fork new child processes. The default value for this parameter is 5

MaxSpareServers
This number determines the maximum number of child httpd processes that are allowed to exist on the machine. If this number is high and the http load is low then the machine will be using up computer resources needlessly. Having this as a high value on a low specification machine is also a bad idea and will give your apache a big footprint (remember this is important is you are running other components on the same machine). The default value for this is 10


MaxKeepAliveRequests
Persistent connections are achieved via the KeepAlive directive, it allows multiple sequential HTTP requests to be made by a client on the same connection if the client indicates that it is capable and would like to do it. To enable this feature use the directive KeepAlive on. Having KeepAlive enabled allows a much more rapid dialog between a client and the server to take place, at the cost of preventing the attached server process from handling any other requests until the client disconnects.

KeepAliveTimeout
To deal with this issue, there is a corresponding KeepAliveTimeout directive. This directive specifies the amount of time an Apache process will wait for a client to issue another HTTP request before closing the connection and returning to general service. Regardless of the time-out value, persistent connections will also automatically terminate when the number of requests specified by MaxKeepAliveRequests is reached.

funka

Legend
ex-prophet(down below)
Registered: Sep 2000
Location: Vienna / SF
Posts: 6131
aja vielleicht kann dir philipp gute tips geben - wenns um apache tunen geht muesste er hier der kompetenteste sein - pm://philipp

Rektal

Here to stay
Registered: Dec 2002
Location: Inside
Posts: 4477
Thx. Ich glaub das Bottlebeck ist einfach das fucking PHP. 0.9ms dauert da ein Request, mit MMTurck Cache ist avg. auf 0.8ms gegangen .. super ;) PHP Accellerator erzeugt zu viele Segfaults. Wieder was gelernt.

Philipp

Here to stay
Registered: Jul 2001
Location: Wien
Posts: 1970
Die original Apache Konfigurationen ist von Haus aus nicht so schlecht. Ich würde höchstens MaxClients etwas höher (bei z.B. 1GB Ram auf 400) stellen.

Um PHP/MySQL zu Beschleunigen kannst du folgendes machen:

1) PHP Bescheuniger installieren

Truck MMCache ist in diesen Bereich ohnehin der beste was ich kenne.

2) MySQL Query Caching aktivieren (ab MySQL 4.0+)

Dazu muss folgendes in my.cnf hinzugefügt werden:
Code:
query_cache_limit = 1M
query_cache_size = 32M
query_cache_type = 1

Beide Lösungen helfen hauptsächlich den Serverload zu reduzieren.

Um den Seitenaufbau zu beschleunigen kann du am Anfang des jeweiligen PHP Scripts (nach <?php) folgende Zeile kopieren:
Code:
ob_start("ob_gzhandler");

Das schickt die Seiten komprimiert an den Browser. Die meisten bekannten PHP Scripte machen das aber selbstständig.

Rektal

Here to stay
Registered: Dec 2002
Location: Inside
Posts: 4477
Danke an mysql cache tip. Wieder 100ms gewonnen

Rektal

Here to stay
Registered: Dec 2002
Location: Inside
Posts: 4477
Bringt eigentlich recompilen mit -O3 -mcpu=pemtiumpro viel (sagen wir mal bei apache und php)?

COLOSSUS

Administrator
GNUltra
Avatar
Registered: Dec 2000
Location: ~
Posts: 12142
Zitat von Rektal
Bringt eigentlich recompilen mit -O3 -mcpu=pemtiumpro viel (sagen wir mal bei apache und php)?

Kann ich dir nicht sicher sagen, aber ich denke mal: nein. und wenn würde ich gleich "auf's Ganze" gehen, und march statt mcpu nehmen.
Kontakt | Unser Forum | Über overclockers.at | Impressum | Datenschutz