Is my VPS apache memory usage normal?

sean2045

Member
Jul 1, 2012
20
0
1
cPanel Access Level
Root Administrator
Hi guys,

I found out apache each process use around 7% total memory,

Code:
nobody    1743  0.0  7.0 170204 73460 ?        S    19:42   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    1744  0.0  7.0 170212 73472 ?        S    19:42   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    1745  0.0  7.0 170220 73472 ?        S    19:42   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    1746  0.0  7.0 170204 73452 ?        S    19:42   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    1747  0.0  7.0 170212 73476 ?        S    19:42   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    1761  0.0  7.0 170600 73804 ?        S    19:44   0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody    4665  0.0  6.7 167588 71104 ?        S    20:07   0:00 /usr/local/apache/bin/httpd -k start -DSSL
Code:
free -m
             total       used       free     shared    buffers     cached
Mem:          1024        443        580          0          0        119
-/+ buffers/cache:        324        699
Swap:         1024          1       1022
My VPS is openvz, it has 1GB memory, 1GB swap, it hosts only 3 brand new websites, 2 wordpress sites and 1 shopping cart.

is this normal apache memory usage? should i worry about it?

Thank you

Sean
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
What PHP handler are you using? Are you using any caching system for PHP such as EAccelerator, xCache or APC? What is your MPM?

Here are the commands to obtain each:

Code:
/usr/local/apache/bin/rebuild_phpconf --current
php -m | grep -i 'eaccelerator\|xcache\|apc'
/usr/local/apache/bin/apachectl -M | grep -i mpm
Thanks!
 

sean2045

Member
Jul 1, 2012
20
0
1
cPanel Access Level
Root Administrator
Thank you,

it's really helpful when you provide those commands for new users like me :)

Code:
/usr/local/cpanel/bin/rebuild_phpconf –current
Usage: /usr/local/cpanel/bin/rebuild_phpconf [--dryrun] [--no-restart] [--no-htaccess] [--current|--available] <Default PHP> <PHP4 Handler> <PHP5 Handler> <Suexec>
 --dryrun       : Only display the changes that would be made
 --no-restart   : Don't restart Apache after updating the php.conf link
 --no-htaccess  : Don't update user configurable PHP mime mapping.
 --current      : Show current settings
 --available    : Show available handlers and PHP SAPIs
 <Default PHP>  : Version of PHP to set as default handler for .php files
 <PHP# Handler> : Type of Apache module to use in serving PHP requests
 <Suexec>       : enabled, disabled, 1 or 0


php -m | grep -i 'eaccelerator\|xcache\|apc'
eAccelerator


/usr/local/apache/bin/apachectl -M | grep -i mpm
Syntax OK
 mpm_prefork_module (static)
Is this correct setting? anything I need to change?

Sean
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hi Sean,

For the first command, you appear to have used a long - rather than a double dash (--). Could you please re-run that command because I'm still not certain your PHP handler:

Code:
/usr/local/cpanel/bin/rebuild_phpconf --current
This should output your PHP 5 PHP handler. Right now, instead you received a response on how to use the area for the help menu with that command.
 

sean2045

Member
Jul 1, 2012
20
0
1
cPanel Access Level
Root Administrator
sorry,

I got this when I tried to copy and paste
Code:
/usr/local/apache/bin/rebuild_phpconf --current
-bash: /usr/local/apache/bin/rebuild_phpconf: No such file or directory
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Sorry, when I thought I had copied and pasted it, the path is cpanel not apache. Please just copy the initial command I provided again but using the -- it has. I'm not sure if your system converted the -- to a long dash or what happened.
 

sean2045

Member
Jul 1, 2012
20
0
1
cPanel Access Level
Root Administrator
here we go:

Code:
/usr/local/cpanel/bin/rebuild_phpconf --current
Available handlers: suphp dso cgi none
DEFAULT PHP: 5
PHP4 SAPI: none
PHP5 SAPI: suphp
SUEXEC: enabled
RUID2: not installed
Thank you

Sean
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
All right, so suPHP doesn't work with PHP OPCode caching such as EAccelerator. Could you uninstall EAccelerator? It isn't working with suPHP anyway and will take up some memory for each Apache process:

Code:
/scripts/phpextensionmgr uninstall EAccelerator
 

sean2045

Member
Jul 1, 2012
20
0
1
cPanel Access Level
Root Administrator
I just did a little research:

"if you're running suPHP, there's no caching solution available to you," like you said suPHP does't work with EAccelerator.

so I choose either speed or security? Is any alternative for suPHP that works with EAccelerator?

I heard cfs + mod_security+suPHP is a good combination, but I still want to keep php caching like EAccelerator.


Thank you.

Sean
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hi Sean,

You could use DSO + mod_ruid2, but that is still considered experimental due to the issues with mod_security it has. DSO without mod_ruid2 would not be considered secure.

FCGI does allow caching engines.

Both DSO and FCGI have higher memory usage than suPHP. On a memory constrained system such as a VPS, suPHP is the better option. You cannot use any caching with suPHP, but you could use mod_deflate for compression instead, which is an Apache module.

Thanks!