Performance Tuning
This page doesn't include tuning on the database. That you'll find here: DbPerformance
This is a page about mod_perl tuning, just ignore the perl stuff and look at the apache tweaks in there. They did help me to get our tw.o stable again. 😊
Additional apache tuning for sites with much traffic (german)
# time out connections earlier, 300 is too much Timeout 150 # clients may keep alive existing connections KeepAlive On MaxKeepAliveRequests 120 KeepAliveTimeout 15 # switch off hostname lookups, that needs some time HostnameLookups Off MinSpareServers 6 MaxSpareServers 8 StartServers 10 # 10 clients should be enough, but for peaks 50 might be good. # depends on your memory, 50 works for 2GB memory MaxClients 50 # dont set this to a value too low: MaxRequestsPerChild 1500
Try to move load from the server, tell clients to cache data:
<IfModule mod_expires.c> <IfModule mod_headers.c> ExpiresActive On # dont cache html as people wont get page updates: # ExpiresByType text/html "access plus 1 month" ExpiresByType text/css "access plus 6 month" ExpiresByType text/javascript "access plus 6 month" ExpiresByType image/gif "access plus 6 month" ExpiresByType image/jpeg "access plus 6 month" ExpiresByType image/png "access plus 6 month" <Files ~ "\.(js|css|gif|jpe?g|png)$"> Header append Cache-Control "public" </Files> </IfModule> </IfModule>
Limit connections from one ip to a given number.
Homepage of mod_limitipconn
<IfModule mod_limitipconn.c> Customlog /var/log/nameofvirtualhost-access-denied.log combined env=LIMITIP <Location /> MaxConnPerIP 10 NoIPLimit img/* </Location> </IfModule>
# if you want to reduce CPU usage, set it to off # if you want to limit traffic, set to on zlib.output_compression = Off max_execution_time = 30 ; Maximum execution time of each script, in seconds max_input_time = 30 ; Maximum amount of time each script may spend parsing request data memory_limit = 16M ; 8 is way too far, try 16 MB here, if you still get blank pages, raise it in 1 MB steps
Homepage: http://www.eaccelerator.net/
Description: A PHP Accelerator & Encoder.
License: GPL-2
eAccelerator is a further development from mmcache PHP Accelerator & Encoder. It increases performance of PHP scripts by caching them in compiled state, so that the overhead of compiling is almost completely eliminated.
If your are compiling and installing eAccelerator yourself, add this to php.ini:
zend_extension="/usr/lib/php4/20020429/eaccelerator.so" <-- path may be different eaccelerator.shm_size="64" <-- set to 32 or 16 if php core dumps .) eaccelerator.cache_dir="/tiki/var/tmp/eaccelerator" <-- path may be different eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9"
Environment:
Athlon XP 2100+, 512 MB DDR, Apache 1.3.X, PHP 4.3.0
1st try:
used a shellscript, that does 10 wget runs at a time with wget -r -l 2. All features in tiki are switched on, anonymous group got basic privileges.
Results:
settings | Time taken | max. load |
bare | 7:17 | 11.5 |
Zend accelerator default | 2:23 | 11.6 |
Zend accelerator 128MB | 2:36 | 11.8 |
turck mmcache default | 2:21 | 11.4 |
turck mmcache 128MB | 2:15 | 11.5 |
2nd try:
Used siege. I took the same URLs that wget crawled. 150 concurrent users:
Zend:
Transactions: 16262 hits Availability: 100.00 % Elapsed time: 420.17 secs Data transferred: 59162949 bytes Response time: 3.44 secs Transaction rate: 38.70 trans/sec Throughput: 140807.17 bytes/sec Concurrency: 133.01 Successful transactions: 16262 Failed transactions: 0
load got up to 110
mmcache:
Transactions: 19360 hits Availability: 100.00 % Elapsed time: 423.15 secs Data transferred: 61369649 bytes Response time: 2.87 secs Transaction rate: 45.75 trans/sec Throughput: 145030.49 bytes/sec Concurrency: 131.49 Successful transactions: 19360 Failed transactions: 0
load got up to 95.
So mmcache seems to be slightly faster. Be extremly careful while testing. siege crashed my server two times 😎
1) |
19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
2) |
Tiki birthday |
3) |
17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
4) |
21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting |
5) |
19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting |