I currently have eAccelerator installed and have adjusted the keepalive to 5. What other settings should I consider?
This is a test server [absolute barebones hardware wise: PIII-800MHz 40 gigHD w/ 256MB ram running Edubuntu (currently at run level 5), Apache2, PHP5.1.6, MySQL, Moodle 1.6.2 (although I could have swore I installed 1.7!!).
Although it has not been updated recently, take a look at this (http://www.ipersec.com/index.php?q=en/bench_ea_vs_apc).
Thanks for the link, interesting reading. For reference sake:
The tests we did showed us there can be an important performance gain by using a PHP accelerator. Using a PHP accelerator seems essential for a high-traffic site.
But PHP accelerators are no panacea : if your code is slow, it will stay slow even with apc, eAccelerator or Zend.
Choosing an accelerator depends on your criteria :
- if you can pay for Zend, and need an official support, use Zend Platform,
- if you don't, eAccelerator is a good choice.
Each tool has advantages and drawbacks, the only way to know which one is the best at handling your code is to test both.
If, as I did, you choose eAccelerator (in order not to spend a dime on it, and to be able to change your files whenever you want), I would advise you not to get too much tied to eAccelerator, you might have to switch to apc in the future...
Per their article benchmarks eAccelerator is a good choice. Granted their review was submitten in May 06, I wonder if the APC folks managed to increase the efficency of their code? At the moment I'm comfortable to stay with eAccelerator. I would like to comment that while the article states a php accelerator is essential for a high traffic site, I feel it is proving essential for a site with limited hardware resources too.
I greatly appreciate everyone’s replies. Today was the first day I've really gotten to see how my pitiful hardware conglomeration would fair; surprisingly enough it hummed right along. For this first attempt at loading the server I didn't allow the students to use chat while taking a quiz and I remained out of any reports. There didn't appear to be any delays in serving pages or compiling results (I'd like to point out that I'm doing this over an adsl line with only 384Kbs up). Moodle is rock’n along now!
I'm going to make my pages a bit more complicated with additional graphics and some audio and video embedded.
Can someone share their settings for eAccelerator (please include load demographics)? ... I'd like to scale it to my situation.
Also, I have a virtual dedicated server from GoDaddy, and it runs PHP eAccel. I have a Moodle installation on there, and the page loads are tremendously improved.
I can't compare APC to eAccel (i've never tried APC), but I can certainly vouch for eAccel's stability and speed.
I was going to write "APC doesn't have any shmem store/add/delete facility" but a quick check of http://au2.php.net/apc lists apc_add(), apc_store(), apc_delete() and apc_fetch(). Maybe I just didn't know about them -- anyway, it'd be trivial to use them.
In any case, the main advantage of APC/Turck/eAccelerator is their caching of precompiled PHP code. The shmem-based query cache that I wrote is an extra -- and is not applicable to every situation. Use it only of you can see demonstrable advantage. In other words, in XX% of the cases it results in _worse_ performance, in YY% it results in better performance.
APC is very good!
eAccelerator is good enough...
mount -t tmpfs /dev/tmpfs /tmp
or put it in your /etc/fstab
/dev/tmpfs /tmp tmpfs 0 2
make sure that you create the directory for eaccelerator each time you reboot your system. (Not often I hope) I would add the commands to your apache startup script.
mkdir -p /tmp/eaccelerator
chown www-data.www-data /tmp/eaccelerator
On Solaris /tmp mounted swapfs and is it correct to put the files into /tmp/eaccelerator.
On Solaris /tmp is mounted swapfs and is it correct to put the eaccelerator files into /tmp/eaccelerator. You will have to remake the directory after a reboot.
In linux tmpfs can be used in the same way, either on /tmp or elsewhere.
My updated task is now.
sudo chown www-data.www-data /var/tmp/eaccelerator
sudo mount -t tmpfs tmpfs /var/tmp/eaccelerator
In your php.ini, change this line to:
Now put it in your /etc/fstab:
tmpfs /var/tmp/eaccelerator tmpfs defaults 0 0
And restart Apache:
sudo /etc/init.d/apache2 restart
You now don't have to recreate the /var/tmp/eaccelerator directory after the reboot, and the tmpfs will automount.
If you are VERY clever, then you might copy the cached files off of the tmpfs when apache stops and copy the cached files back on when apache starts.
While tuning this I got a %75 decrease of page time and %80 decrease of memory usage. (I also had a database issue from the old perspective.php script)
My courses page takes 0.368522 secs and RAM: 3.9MB
Your milage may vary,
The correct thing from a FHS point of view is to use /var/cache/eaccelerator and set it to be owned by the apache user, and mode 0600 -- this is what Debian does.
The other thing to note is that eaccelerator has controls to say how much of the precompiled files it will cache in memory. The on-disk files are for precompiled files that fell out of the memory cache (I think eAccelerator has a cheap LRU algorithm to purge pages), and for persistence across apache restarts.
My recommendation would be to NOT use a tmpfs as it mucks up the reasonably efficient approach of eaccelerator, and to make sure /var/cache/eaccelerator is on a partition mount with noatime,async and that the journaling mode is set for performance.
(This post brought to you by pedantic day )
I'm going to fix it as soon as I can. Thanks for the correction!
Im planning to experiment eaccelerator if performance is better?