Tuesday 11 July 2006 3:36:46 am
Here are some of the conclusions/notes about improving the eZ publish deployment environment. <b>1. Apache</b>
<b>1.1. Version</b>
According to Bertrand Dunogier's article "eZ publish: Performance Best Practices" ( http://ez.no/community/articles/ez_publish_performance_best_practices ), Apache 1.x should be used. If 2.x version has to be used, it should be run under pre-fork mode, which prevents Apache 2 from using threads.
Intel ICC compiled Apache should be used (Bård Farstad: eZ publish Performance.pdf). Apache/PHP/APC compiled with the ICC compiler shows eZ publish template processing is faster from 17.4% to 19.6%. Total script runtime measured with ab ranged from 6.3% to 12.7% faster. ( Bård Farstad: http://papelipe.no/tags/ez_publish/benchmark_of_intel_compiled_icc_apache_php_and_apc ) <b>1.2. configuration</b> Correct configuration of the following parameters is extremly important for good performance. * MaxClients - this parameter sets the limit of total number of worker processes - it defines how many simultaneous requests can be supported. The more processes apache is allowed to run, the more simultaneous requests it can serve. As you increase that number, you increase the amount of RAM that Apache will take. So, the optimal value depends on the resorces of the server (RAM). MaxClients can be calculated by the following formula:
MaxClients = (TotalRam - MSRPC) / (MaxProcessSize - MSRPC)
TotalRam - estimated total RAM available to the Apache
MSRPC - Minimal Shared RAM per Child
Check http://modperlbook.org/html/ch11_01.html for more explanations and examples. If MaxClients is set too high, this will cause the server to start swapping and become unresponsive. If MaxClients is set to low, connections will be unnecessarily queued (and maybe some of them will time-out), while server resources are left unused.
Any connection attempts over the MaxClients limit will normally be queued, up to a number based on the ListenBacklog directive ( http://www.apacheref.com/ref/http_core/ListenBacklog.html )
* KeepAlive - Turn On KeepAlive. It allows multiple requests to be sent over the same TCP connection so it reduces the overhead of frequent connects.
* KeepAliveTimeout
If server oftenly hits the MaxClients limit, KeepAliveTimeout should be reduced (default is 15 seconds, try with 2-6 seconds). This will allow Apache to terminate the connection soon enough and to be able to handle other queued connections. If there are a lot more clients than available apache children, KeepAlive On will decrease performance and should be turned off.
* MinSpareServers (default 5). It takes time to start the apache process which is ready to serve incoming requests. So if server load varies, this should be set to higher value to assure quicker response in that situations.
* MaxSpareServers (default 10). Keeping it low allows OS to use RAM for other tasks. Could be kept higher if it's a dedicated machine.
* StartServers (default 5). If it is set to high, it will assure that if you get a high load just after the server has been restarted, the fresh servers will be ready to serve requests immediately. ( http://modperlbook.org/html/ch11_03.html )
* MaxRequestsPerChild. Sets the limit on the number of requests that an individual child process can handle during its lifetime. Setting to non-zero value solves memory-leakage problems, by forcing the apache to restart child process. ( http://modperlbook.org/html/ch11_02.html ) I am not sure what's the best practice here regarding eZ publish. Please advise. * MaxKeepAliveRequests: how many total requests a client can issue across a single connection. Please advise is there any need to change the default value (100). Some methods how to determine correct values of above options can be found at http://www.apacheweek.com/features/mod_perl14
<b>1.3. Modules</b> Only required modules should be loaded. This reduces memory footprint. For instance, if Perl or CGI isn't used, get rid of it.
<b>2. PHP</b>
<b>2.1. Version</b>
eZ publish requires PHP 4.3.x for the 3.6 branch, PHP 4.4.x for the 3.7+ branch
Use Intel ICC compiled binary.
Statically compiled PHP module is faster than a DSO module for about 10% ( http://ez.no/community/blog/php_as_dso_or_as_static_php_module ) Compile with --disable-memory-limit to gain some more speed (Derick Rethans on ez forum)
<b>2.2. PHP extensions</b>
Required PHP extensions for eZ publish)
- session
- mysql or pgsql - gd2 or the ImageMagick program
Optional PHP extensions
- gd2 with FreeType support
- zlib
- mbstring
- exif - domxml (this will speed up performance in some cases) <b>2.3. Configuration</b>
Required:
- max_execution_time should be set to at least at least 30 (300 recomended)
- memory_limit should be set high enough (more than 64 MB is recommended) (Bertrand Dunogier). I have expirienced very large memory consumption when using ezodcsm (I had to set memory_limit to 384 MB)
- Safe mode should always be disabled (safe_mode Off)
- open_basedir ""
- magic_quotes_runtime Off
- allow_url_fopen On
- file_uploads On - AcceptPathInfo On (only for Apache 2)
Optional:
- register_globals Off
- magic_quotes_gpc Off
(Please notify if something is missing)
<b>3. MySQL</b>
Intel ICC compiled binary are allready availble for download (Linux Intel C/C++ compiled section)
http://dev.mysql.com/downloads/mysql/4.1.html
http://dev.mysql.com/downloads/mysql/5.0.html Some issues with stability have been reported with the Intel CC compiled version.
Comparison between GCC compiled vs. Intel ICC compiled MySQL when inserting objects into eZ publish ( Bård Farstad: http://papelipe.no/tags/ez_publish/ez_publish_faster_running_on_intel_optimized_mysql )
In order to use UTF-8 use MySQL 4.1 or later, previous versions only support the ISO character set.
<b>3.1. Tuning</b>
(Bård Farstad: eZ publish Performance.pdf)
- Re-compile with optimization
- Optimize settings
- Key buffer
- Table cache
- Sort buffer
- Query cache
- Max connect ions
- No flush at commit
- InnoDB buffer pool size
- InnoDB additional mem size - Log buffer size *Edit: This is now an article: Tuning MySQL for eZ Publish - http://ez.no/community/articles/tuning_mysql_for_ez_publish <b>4. Opcode cache (eAccelerator / APC configuration)</b>
<b>4.1. eAcceleator</b>
I suppose that eAccelerator can also be compiled with the ICC compiler, but didn't try it (i am using the 0.9.4 binary release).
<b>4.2. eAccelerator configuration</b>
Adjust eAccelerator options (which are configured through php.ini). This is how I'm currently using it (please notify if you have any configuration advices here):
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/home/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="1200"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
Explanaton of this parameters can be found on http://eaccelerator.net/wiki/Settings. To be effective, eaccelerator should be able to allocate enough memory (shm_size). If you can't set shm_size to more than 32 MB, read the http://eaccelerator.net/wiki/Faq.
<b>4.3. APC</b>
Compile APC with the ICC compiler.
I didn't use APC. Please notify if you have better results or better control with APC (or any other pros/cons).
<b>4.4. Zend Optimizer</b>
Although eAccelerator works with Zend Optimizer, it won't give any extra performace. So, Zend Optimizer should be loaded ONLY if you have to run encoded PHP scripts. Some performance comparisons between Zend Optimizer and eAccelerator can be found on http://blog.robinz.info/archives/2006/02/14/should-we-use-zend-optimizer-and-eaccelerator-together/
<b>5. Squid Cache</b>
(from the Bård Farstad: eZ publish Performance.pdf)
- Cache CSS, JavaScript , images and files
- Cache complete XHTML pages (didn't use it yet, but planning to)
<b>6. HDD/filesystem tuning</b>
<b>6.1. noatime option</b> (Bård Farstad: eZ publish Performance.pdf). Effect of using noatime is explained here: http://www.faqs.org/docs/securing/chap6sec73.html
<b>6.2. hdparm</b> Default Linux installs are also notorious for setting hard disk default settings which are tuned for compatibility and not for speed. Use the command hdparm to tune your Linux hard disk settings. ( http://phplens.com/lens/php-book/optimizing-debugging-php.php ) So girls & guys, share your information :)
<b>Resources</b> (except allready mentioned)
http://httpd.apache.org/docs/1.3/misc/perf-tuning.html
http://www.howtoforge.com/configuring_apache_for_maximum_performance
http://virtualthreads.blogspot.com/2006/01/tuning-apache-part-1.html
http://emergent.urbanpug.com/?p=60
http://www.perlcode.org/tutorials/apache/tuning.html
http://linuxgazette.net/123/vishnu.html
http://blog.coomanskristof.be/2006/07/07/ezpublish_requirements/ http://ez.no/content/download/134038/852831/version/3/file/ez2006_ezpublish_performance.pdf
http://www.netgen.hr/eng
|