Day by day I’m being a BIG fan of VPS as anything possible can be done here if I want. In shared hosting, some limitations are present which give Huge Pain to work. And now-a-days Low End Boxes are available for us which are enough for me.
As my box is a small one (With 512MB memory), it was not possible to use cPanel smoothly and financial factor was also important for me. So I choose Kloxo. Afetr installing, I was enjoying the power of open source and free alternative of cPanel and/or Plesk. When I set up a WordPress based blog, 98% of total memory was reserved. And then I requested some expert for a solution. Most of them asked me to remove panel and to use Nginx/Lighty etc etc. But panel was required for me and I am a Great Fan of Apache for extended support. I googled and many ways to reduce memory usages. From them I want to share the effective one according to me with you. Let’s start.
Apache Optimization:
Type the lines bellow in your SSH window.
Find out the lines like bellow and replace the values.
MinSpareServers 3
MaxSpareServers 10
ServerLimit 50
MaxClients 50
MaxRequestsPerChild 2000
Turn Keepalive off.
Set Timeout value from 120 to 40.
Save pressing Crtl + X, then Y and vice versa.
MySQL Optimization:
Too simple, type
And add two lines bellow [mysqld], and it’ll look like bellow.
skip-innodb
skip-bdb
Okay, save now.
Final Step:
Now you have to restart Apache and MySQL.
For Apache:
For MySQL:
Now Check Memory
Enjoy!
Hi, this is Tanmoy, a 24 year old guy and just completed graduation on Business Management. I'm one day anticipating that this course will provide me with an array of the necessary skills and experiences needed for me to be a successful entrepreneur
for mysql use
max_connections = 300
key_buffer = 32M
myisam_sort_buffer_size = 32M
join_buffer_size = 1M
read_buffer_size = 1M
sort_buffer_size = 2M
table_cache = 4000
thread_cache_size = 286
interactive_timeout = 25
wait_timeout = 7000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_limit = 2M
query_cache_size = 12M
query_cache_type = 1
tmp_table_size = 16M
skip-innodb
[mysqld_safe]
open_files_limit = 8192
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 16M
write_buffer = 16M
[mysqlhotcopy]
interactive-timeout
for httpd
MaxClients 2047
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
MinSpareServers 5
MaxSpareServers 20
ServerLimit 2047
MaxClients 2047
MaxRequestsPerChild 4000
Just skipping innodb and bdd, you can reduce RAM usage upto 100MB! And I always try to ease so that newbie like me can easily do.
Thanks for your comment.
thanx really helped decreased RAm Usage
can u please tell is there any effect on disabling
[mysqld]
skip-innodb
skip-bdb
what are there purpose thanx looking for help
Learn more about innodb, please check this link.
Actually innodb isn’t required for most of the application, so no need to keep it alive in MySQL server.
I have a vps 2gb ram, 2 ghz cpu and for a large site
I need to use innodb
Can you give an advance for optizme apache and mysql. MY site load very slow
As you have a large box, you didn’t need these. You website loads slower perhaps for other reason. Use caching system, CDN etc.
Best of luck.