Knowledgebase

How can I optimize my VPS to use less CPU by using more RAM

Posted by KingOfDCP, 09-19-2011, 04:06 AM
Hello, I'm running my site on VPS but it use very much CPU resources and use only avg 500 MB RAM when I have 1.5 GB My VPS use 4 core CPU E31240. I'm using kloxo As the title, I want to optimize my VPS because sometime kloxo auto restart apache (2-3 times/day) I attached two pictures for more information. If you need more, let me know. Please help me, I'm confusing. I appreciate your help Thanks, Attached Thumbnails    

Posted by UNIXy, 09-19-2011, 04:09 AM
Some options since MySQL appears to be the top offender: Memcached MySQL-Proxy + caching (complex setup) Varnish Regards Joe / UNIXY

Posted by relichost, 09-19-2011, 04:31 AM
Hi Have you optimized Mysql ? Thanks

Posted by KingOfDCP, 09-19-2011, 05:07 AM
Honestly, I installed memcached and varnish follow some guide on the internet but it seems I had config in wrong way so it's very good if you can provide me some right guide to follow when I'm a beginner. Yes, I optimized Mysql by edit my.cf. This is my my.cf file

Posted by dgarbus, 09-20-2011, 02:24 PM
What do your Apache settings look like? For example, how many requests per child process are allowed? Are you using keepalives? Also, since you seem to have a fair bit of memory, you can probably have MySQL do some additional caching to prevent the CPU from having to do so much work.

Posted by PCS-Chris, 09-20-2011, 02:41 PM
I'm no MySQL optimization expert but that configuration doesn't suit your server. Here are a few things I would change straight away: 1) The whole purpose of max_user_connections is so that one user can't max out MySQL and use upto your max_connection limit. You have both the same so you might as well remove max_user_connections or set a sane limit. I normally allow 30-35 per user connections. A connection limit of 300 is also very high? 2) If you have lots of RAM free you want to get as much of your databases in memory as possible, this will free up I/O and in turn reduce CPU usage. Increase those to 256MB 3) Add "thread_concurrency", normally 2x the number of CPU cores you have is the way to go. You can also use "mysqladmin processlist" so you can see specifically which databases/tables/queries are causing load. The majority of MySQL performance gains are through optimizing code rather than the server. On Wordpress for example you can use something like WP_Supercache which takes a lot of load off the database each time a page is refreshed. Is your VPS OpenVZ or Xen? Why is Kloxo restarting Apache, is your system running out of memory? You need to identify what the cause is. If it's generic HTTP/DoS activity you can mitigate it quite well just with a firewall like CSF.

Posted by KingOfDCP, 10-01-2011, 04:09 AM
Hi, My VPS is OpenVZ and after have many troubles with kloxo (not familiar) I decided to use cpanel and it has better result. After taking some changes, this is new my.cf And this is result Please look at bold text. That make me confuse. And please give me more advice to optimize by using more RAM because I only used avg 600MB and max 800MB when I have 1.5 GB at all. Thanks

Posted by WebHostDog, 10-01-2011, 05:17 PM
Seems there is some MySQL abuse/problem. You need to find which query/es is causing all this load and fix it.



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
Hostnine Adventure!?!? (Views: 548)


Language:

Client Login

Email

Password

Remember Me

Search