[cPanel VPS optimizations] Suggestions on tuning MySQL and Apache for a server with 2GB of RAM?

Keith Hinton

New Member
Hello everybody.
I'm working on a cPanel/WHM server that is maxed out at 2GB of installed RAM.
I'm wondering therefore, if anybody has any suggestions for properly tuning Apache, MySQL, and other similar services for optimal configuration?
I found a Liquid Web knowledge base guide that talked about some possible values (or at least what they would recommend) for a 2GB RAM system, however, I am hesitant about just blindly following any tutorial, in case adjusting these values has a negative effect or are not optimal values for a 2GB RAM server.
I thought I would bounce the tutorial link off you folks anyways, and reach out to you folks just to see if any of you have useful recommendations that might be starting points before I start tweeking values in Apache's configuration file, or My.cnf in MySQL.
Just so you know, the contents of the /etc/My.cnf file currently are as follows:
[mysqld]
innodb_file_per_table=1
That's all that is in their at the moment.
The Knowledge base article I found on Liquid Web (while actually performing a Google search) before I thought about just asking here to see what you folks have to say, is here:
http://www.liquidweb.com/kb/apache-optimization/
I also have another guide found here:
http://www.gk-root.com/optimize-mysql-apache-php-on-cpanel-whm-server/
Any ideas are much appreciated before I start hacking away at configuration file values randomly.
 

Quags

Administrator
Staff member
This is for cPanel servers and optimizations.

1) Recompile Apache/PHP with mod_ruid2 and enable XCache. Turn off suphp. As for apache versions I recommend 2.2 currently as 2.4 is still newer with in cpanel. This is the lowest cpu/ram intensive way to run Apache.

2) change BIND to NSD in nameserver selection to reduce memory. If you do not run nameservers on the VPS disable it completely. You can use the free cdns1/cdns2/cdns3.interserver.net nameservers in my.interserver.net

3) If you do not use cpanel webdisk disable it in WHM->service manager (turns off cpdavd)

4) If you do not use mailman lists, disable it in WHM->tweak settings (turns off mailmanctl).

5) Enable dormant services in WHM->tweak settings for the services you are running, for example cpdavd

6) Install csf firewall and configure LFD. Disable cphulkd

7) Tweak mysql for query caching. In /etc/my.cnf

Code:
[mysqld]
query_cache_limit=4M
 query_cache_size=128M
 query_cache_type=1
This is a good range for 2GB VPS

restart mysql after the changes are made with /etc/init.d/mysqld restart

8) If you do not use stats, disable them in WHM->statistics software configuration. At minumum disable them by default, and enable the option to let user's choose to run them in cpanel->choose log programs
 

Keith Hinton

New Member
Hi,
I wanted to update this thread and have done most of the suggestions mentioned.
However, their is one thing I did look at and that is the Apache prefork module values.
I think these may be high for 2GB of RAM.
Any suggestions as to what might make better sense possibly?
Hear are the settings it's presently configured for:
Start Servers 5
Minimum Spare Servers 5
Maximum Spare Servers 10
ServerLimit 256
MaxClients 150
MaxRequestsPerChild 10000
That all seems a bit too high for only 2GB of RAM.
 

cortana

New Member
How are the new DB setups in comparison to MySql? Are they worth switching to? Can you migrate db's without losing any data?
 

pawlo.litasi

New Member
I thought I would bounce the tutorial link off you folks anyways, and reach out to you folks just to see if any of you have useful recommendations that might be starting points before I start tweeking values in Apache's configuration file, or My.cnf in MySQL. Kodi nox
 
Last edited:
Determining Free Memory and Swap Activity
Setup LAMP Server in a Low Memory Situation
Stop, Disable unused services
Tune Apache to only have a small number of spare children running.
Only load the modules you require
Optimize MySQL server
Disable Things you dont want.
Maximum Number of Connections
hope this helps you. get more information on servers on Apps4Rent
 
Top