Portal Home > Knowledgebase > Articles Database > MySQL CPU usage over 300%
MySQL CPU usage over 300%
Posted by PirateSolutions, 06-14-2011, 05:26 PM |
Hello,
Im running this config on my VPS:
Intel Xeon x3440
8GB RAM
2x 500GB disks raid1
Currently running Kloxo, php as dso, and nginx in front of apache. nginx serves static files, problem is CPU usage. Do you have any suggestions how to reduce CPU usage, using cache systems like memcached or varnish? I currently have onyl eaccelelator but it doesnt help much. /etc/my.cnf is already optimized.
Any suggestions would be appreciated.
|
Posted by wartungsfenster, 06-14-2011, 06:22 PM |
too little data. :>
but based on that (300% mysql use) - go with memcached
|
Posted by PirateSolutions, 06-14-2011, 06:32 PM |
Hi!
Problem is reading from mysql and writting to mysql. I know writting cant be helped but reading from mysql can be improved by caching. I currently run nginx as a frontend. Now, options are memcached OR vernish, I basically need something what will cache the dynamic pages and help me reduce mysql CPU usage.
Now, I installed memcached as suggested above, but how do I insert it into nginx. Here is my vhost.conf
http://pastebin.com/Hj4fXtCw
If someone has other suggestions please share!
Thank you very much
|
Posted by wartungsfenster, 06-14-2011, 07:09 PM |
The first thing is to not generate what doesn't have to be dynamic.
A friend of mine had a table of thumbnails that was recreated a few dozen times per second... Instead one can use multiple static versions that are generated once per second and delivered statically. This is where you save, by 1000s - the most performance.
Next, you need to hook up mysql and memcached i think
and last,
http://www.frequency.com/video/high-concurrenc/6174481
watch that from start to end.
|
Posted by barbus, 06-15-2011, 06:03 AM |
I'd suggest you to determine which server eats a lot of CPU.
It could be MySQL or apache or even nginx.
It's useful to monitor your IO wait. You can do it with top.
Also consider using of redis. It's very fast.
|
Posted by lynxus, 06-15-2011, 06:19 AM |
Enable slow query logging.
The chances are its just a bunch of badly made up querys or badly indexed tables.
|
Add to Favourites Print this Article
Also Read