Eaccelerator using /dev/shm as cache dir

#1
I saw this tip posted by George buried in another thread. I thought it deserved it's own thread where we can share our experiences with this tip.

If you got some spare memory in your server not being actively used, there is one tip to improve PHP and overall server performance. :)

Requirements:

* there are enough free memory to spare.
* /dev/shm/ should be mounted as tmpfs.

Install eaccelerator with PHP suEXEC, set disk cache storage to /dev/shm/eaccelerator/ instead of /tmp/eaccelerator/, then add a cron job to clean the cache directory every 5-10 minutes, so cache files not being used frequently will not fill up the precious shared memory storage.

Noticed that the server load going down from 4.x to 1.x on one client's server.
 
#2
I see someone had an issue getting this working:

Are these setting right to optimize? I'm confused on what value eaccelerator.shm_size should be if i set the disk cache to /dev/shm with 1.5G of space.


php.ini
Code:
extension_dir = "/usr/local/lsws/lsphp4/lib/php/extensions/no-debug-non-zts-20020429"
extension="eaccelerator.so"
eaccelerator.shm_size="64"
eaccelerator.cache_dir="/dev/shm/lswsphp4eacc"
eaccelerator.enable="1"               
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.shm_max="0"                 
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys="shm"
eaccelerator.sessions="shm"
eaccelerator.content="shm"
/etc/fstab
Code:
none                    /dev/shm                tmpfs   noexec,nosuid   0 0
df -h
Code:
none                  1.5G     0  1.5G   0% /dev/shm
We had the same problem. What fixed it for us - and I still don't know why - is changing one variable and nothing else:

----
;eaccelerator.shm_size="128"
eaccelerator.shm_size="16"
-----

Anyone have any ideas? The test server we are working on has 8gb of ram and over 4gb free for us, so I'd like to get this value higher to see if we can cache more...

anewday, did you get this to work?
 
#4
I suspect your are hitting your kernel max. Check out

http://eaccelerator.net/wiki/Settings and kernel.shmmax = value

setting it to 128 should allow you to increase eaccelerator to 64 + for example.

I see someone had an issue getting this working:



We had the same problem. What fixed it for us - and I still don't know why - is changing one variable and nothing else:

----
;eaccelerator.shm_size="128"
eaccelerator.shm_size="16"
-----

Anyone have any ideas? The test server we are working on has 8gb of ram and over 4gb free for us, so I'd like to get this value higher to see if we can cache more...

anewday, did you get this to work?
 
Top