LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > How to setup Litespeed LSWS for a shared environment?

Reply
 
Thread Tools Display Modes
  #21  
Old 04-05-2009, 12:00 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
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.
Reply With Quote
  #22  
Old 04-05-2009, 02:05 AM
DraCoola DraCoola is offline
Senior Member
 
Join Date: Mar 2009
Posts: 149
Quote:
Originally Posted by mistwang View Post
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..
Reply With Quote
  #23  
Old 04-05-2009, 08:52 AM
anewday anewday is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 723
Do you mean the value for "eaccelerator.shm_size" ?
Reply With Quote
  #24  
Old 04-05-2009, 09:31 AM
Tony Tony is offline
Senior Member
 
Join Date: Dec 2008
Posts: 133
Quote:
Originally Posted by mistwang View Post
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.
__________________
Hawk Host
Frog Host
Reply With Quote
  #25  
Old 04-05-2009, 10:43 AM
DraCoola DraCoola is offline
Senior Member
 
Join Date: Mar 2009
Posts: 149
Quote:
Originally Posted by anewday View Post
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.
Reply With Quote
  #26  
Old 04-05-2009, 11:15 AM
Tony Tony is offline
Senior Member
 
Join Date: Dec 2008
Posts: 133
Quote:
Originally Posted by DraCoola View Post
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.
__________________
Hawk Host
Frog Host
Reply With Quote
  #27  
Old 04-05-2009, 01:54 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Quote:
Originally Posted by Tony View Post
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.
Reply With Quote
  #28  
Old 04-05-2009, 01:58 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Quote:
Originally Posted by DraCoola View Post
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.
Reply With Quote
  #29  
Old 04-05-2009, 04:59 PM
anewday anewday is offline
Senior Member
 
Join Date: Nov 2007
Location: New York
Posts: 723
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
Reply With Quote
  #30  
Old 04-05-2009, 05:33 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
looks good to me.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:30 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.