Situation:
eAccelerator 0.9.5-rc1 [shm:mmap_anon sem:spinlock]
PHP 5.1.6 [ZE 2.1.0]
Using apache2handler on FreeBSD server 6.1-RELEASE-p3 FreeBSD 6.1-RELEASE-p3 #2: Wed Sep 13 14:56:33 BST 2006 root@server:/usr/src/sys/amd64/compile/MISSION amd64
2x Dual Core AMD Opterons 4GB RAM.
[eaccelerator]
zend_extension="/usr/local/lib/php/20050922/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="10"
eaccelerator.shm_prune_period="5"
; don't use disk cache right now, as it causes segfaults
; eaccelerator.shm_only="0"
eaccelerator.shm_only="1"
;eaccelerator.keys = "shm_and_disk"
;eaccelerator.sessions = "shm_and_disk"
;eaccelerator.content = "shm_and_disk"
eaccelerator.keys = "shm"
eaccelerator.sessions = "shm"
eaccelerator.content = "shm"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path="/usr/local/www/mission.realtsp.com/server/control.php"
Caching enabled yes
Optimizer enabled yes
Memory usage 75.32% (80.95MB/ 128.00MB)
Free memory 28MB
Cached scripts 1296
Number of apache processes ~50
Problem:
We are getting very high "system load" in top (vs user load which is relatively low):
last pid: 26059; load averages: 20.47, 15.48, 15.53 up 0+06:04:09 13:31:37
CPU states: 18.0% user, 0.0% nice, 75.6% system, 0.2% interrupt, 7.3% idle
When we profile the php application it turns out that 75% of total parse time is spent on doing all the "requires". When server load is low the requires take 100ms. When load grows the requires take 1.3s while the rest of the application code grows from 200ms to 500ms. ie eA is getting 13x times slower at providing the cached code while the rest of the app is only 2.5x slower.
It seems like the apache processes are maybe "locking each other out" from retrieving the cache. Each process has to "require" about 500 files = 30MB on each request. Should there even be a lock when they are only reading the cache?
there is lots of memory on this machine. Having eA @ 128MB gives the worst result. If we reduce it to 32MB (which produces some swapping in eA memory) it runs much much better!
We have also changed our application code to use autoload so we only require what we need. That obviously helps enormously. Previously we never bothered with autoload because eA was so fast as serving the compiled code. Now on this 4 cpu-core machine with high load it is a very different story. 70% of the CPU is eaten up by waiting for ea to server the compiled code. turning eA off altogether only slows it down a further 10%.
We have contained the situation for now by "requiring" less by using autoload and using a smaller (weird!) eA memory.
hoping that there is better long term solution?
Should we try SEM=IPC or shm=sysv? How can we compile with those options?
Thanks