|
|

04-05-2009, 12:00 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,603
|
|
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.
|

04-05-2009, 02:05 AM
|
|
Senior Member
|
|
Join Date: Mar 2009
Posts: 152
|
|
Quote:
Originally Posted by mistwang
Noticed that the server load going down from 4.x to 1.x on one client's server.
|
On my server? 
Thank you mistwang for your helps and advices 
Btw on my eAccelerator, it could only caching from 1 to 19 scripts, maximum.
Or it perhaps caused by shm value/size has set to just 16mb?
Because if I increase it to more than 16mb, some of random pages will suddenly blank, not completely load, or shows an alien codes on it.
Last edited by DraCoola; 04-05-2009 at 02:18 AM..
|

04-05-2009, 08:52 AM
|
|
Senior Member
|
|
Join Date: Nov 2007
Location: New York
Posts: 729
|
|
|
Do you mean the value for "eaccelerator.shm_size" ?
|

04-05-2009, 09:31 AM
|
|
Senior Member
|
|
Join Date: Dec 2008
Posts: 133
|
|
Quote:
Originally Posted by mistwang
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.
|
Interesting.
We played around with eaccelerator a bit on one machine but for the density of our machines it's not even worth doing. We actually had higher i/o wait due to the amount of cached files it ended up writing. I think in the end we had about 12GB of cached files eccelerator does have a memory only feature but I did not see any real improvements. I'm guessing it has to do with the timeout of the PHP processes and such.
This /dev/shm idea seems interesting though. I might play around with that when we start deploying nehalem based servers with 12+GB of ram.
|

04-05-2009, 10:43 AM
|
|
Senior Member
|
|
Join Date: Mar 2009
Posts: 152
|
|
Quote:
Originally Posted by anewday
Do you mean the value for "eaccelerator.shm_size" ?
|
Yes that is.
I've been with php as DSO (on Cpanel-Apache), and set the eaccelerator.shm_size to 2048 and that were fine.
Except it were doesn't fine on DSO-nobody security.
|

04-05-2009, 11:15 AM
|
|
Senior Member
|
|
Join Date: Dec 2008
Posts: 133
|
|
Quote:
Originally Posted by DraCoola
Yes that is.
I've been with php as DSO (on Cpanel-Apache), and set the eaccelerator.shm_size to 2048 and that were fine.
Except it were doesn't fine on DSO-nobody security.
|
If my memory serves me right with PHP processes running as their user this changes the meaning of this slightly. The shm size would be on a per process or user basis I cannot remember which. So when you say a max of 2048 when running LSAPI or even FastCGI on Apache it's not doing shared between all the pools that's just one user set.
This is also why it gets confusing the reporting of eaccelerator you'd need the script for each user account to see the accurate numbers.
I'm pretty sure on most of this as I did some testing to see what exactly happens as I had never ran caching extensions when PHP was running as various users.
|

04-05-2009, 01:54 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,603
|
|
Quote:
Originally Posted by Tony
We played around with eaccelerator a bit on one machine but for the density of our machines it's not even worth doing. We actually had higher i/o wait due to the amount of cached files it ended up writing. I think in the end we had about 12GB of cached files  eccelerator does have a memory only feature but I did not see any real improvements. I'm guessing it has to do with the timeout of the PHP processes and such.
|
Yes, that's true that it will cause high I/O wait if you use /tmp/eaccelerator/ as the storage. However, using /dev/shm/ is more like using a memory disk, which is lightening fast without increasing I/O wait.
|

04-05-2009, 01:58 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,603
|
|
Quote:
Originally Posted by DraCoola
Btw on my eAccelerator, it could only caching from 1 to 19 scripts, maximum.
Or it perhaps caused by shm value/size has set to just 16mb?
Because if I increase it to more than 16mb, some of random pages will suddenly blank, not completely load, or shows an alien codes on it.
|
No need to increase it or let it cache more pages in memory, as the disk cache is actually in memory, also PHP process will start/stop more frequently in PHP suEXEC mode for shared hosting. As long as PHP process can grab a copy of parsed PHP opcode from memory disk, it is fine.
|

04-05-2009, 04:59 PM
|
|
Senior Member
|
|
Join Date: Nov 2007
Location: New York
Posts: 729
|
|
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
|

04-05-2009, 05:33 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,603
|
|
|
looks good to me.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 10:57 PM.
|
|