I am using Moodle 1.9.16+
I just installed eAccelerator 0.9.5.3 and everything looks good.
But i notice that sometimes the number of Cached Scripts increases but sometimes decreases.
My question is:
1) Should the Cached Scripts retain in cache so the number should always increases?
2) I have created cache directory /tmp/eaccelerator with 0777 permission but nothing happened, always a empty directory. so where is eaccelerator cache stored?
Thank you in advance!
eaccelerator.keys | session | content
These settings control the places eAccelerator may cache user content. Possible values are:
- shm_and_disk cache data in shared memory and on disk (default value)
- shm cache data in shared memory or on disk if shared memory is full or data size greater then "eaccelerator.shm_max"
- shm_only cache data in shared memory
- disk_only cache data on disk
- none don't cache data"
This directory is used for the disk cache. eAccelerator stores precompiled code, session data, content and user entries here. The same data can be stored in shared memory (for quicker access). The default value is "/tmp/eaccelerator".
eaccelerator.cache_dir = "/tmp/eaccelerator"
This is easy because that directory is easily writable to everyone, and mounted with noexec. However, it isn't the best because on a lot of systems this directory is cleared on reboot. A better place is /var/cache/eaccelerator. Create the directory and make sure it's writable to the process eAccelerator runs under.
A safe bet is making it world writeable, a safer and cleaner way is making the user php runs under (most of the time the same user as apache or lighttpd) the owner and set 0644 permissions.
'spirit of sharing', Ken
Thnak you for the quick reply.
I changed the cache directory to /var/cache/eaccelerator(permission 0777) and reboot the server but still got nothing...
it shows Cached scripts about 300～500 but i can`t find anything created in var/cache/eaccelerator .
Does the php info show shm_and_disk? Could be that it's not actually needing to write to the cache directory yet. From what I can gather, shm is memory where as disk is just that ... physical file in /var/cache/eaccelerator.
To be honest, tried using once, but guess I had a situation where an accelerator actually reduced performance ... ie, didn't improve. Guess I need to re-visit again with version 2 of Moodle.
Anyone else have some info to share? ;)
'spirit of sharing', Ken
"I use eAccelerator 0.9.6.1 but cache scripts = 1 all the time Why?" http://moodle.org/mod/forum/discuss.php?d=166284 (solution in the final post).
To answer your question "1) Should the Cached Scripts retain in cache so the number should always increases?" - the number does not always increase because of your eaccelerator.shm_size and eaccelerator.shm_ttl settings. You have 64 MB allocated for the cache and a time-to-live of 3600 seconds (1 hour). When eAccelerator doesn't have enough free shared memory to cache a new script it will remove all scripts from shared memory cache that haven't been accessed in at least shm_ttl seconds. In other words, when a script has not been used for an hour and the memory is full, the script gets removed to make room for new scripts to be cached. That is why the number of cached scripts keeps changing.
Tuning those two settings can make a significant change in performance I have discovered over the past two weeks with APC.
To answer your question #2...the reason you never see anything in the cache directory is because of eaccelerator.shm_only = 1 says NOT to use it, to ONLY use the shared memory. Default value is "0" which allows eAccelerator to use disk and shared memory cache for scripts. I would think the way you have it set would be faster than using a spinning hard drive as a cache because it is MUCH slower than memory, even if you have to remove something before the new script can be cached.
Hope this answered your questions,