-1

I got a problem with CPU usage on my VPS, mysqld use 100% CPU and my site go down, i have a small package, 512MB Ram, wich 300 is free, and my site has 1000-1500 unique visitors, and 50.000 views / week.

my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
query_cache_size=8M
read_rnd_buffer_size=256K
tmp_table_size=16M
max_heap_table_size=16M
thread_cache_size=4
sort_buffer_size=2M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

My question is, if i upgrade RAM it's possible that CPU usage go back to normal?

  • Check your `slow_query` log and see if there's anything you can optimize. Aside from that, you're going to have to post some more detailed CPU/memory/IO statistics than just '100% CPU'. ie: unless a significant portion of your time is spent in `IOwait` you're not going to regain any CPU cycles by adding more RAM. – Sammitch Oct 11 '13 at 22:06
  • you could try increasing your query_cache_size to reduce the number of times a result has to be generated: http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html. This would incur an increase in memory usage as the cache is stored in memory. – john Oct 11 '13 at 22:17
  • How big is your database? How smart are your queries? – David Schwartz Oct 12 '13 at 03:48
  • My database has 1GB, and 1 milion rows on a table. – BadWolf Oct 12 '13 at 08:08

1 Answers1

0

Solved, was one query in footer wich selected from a table with ~1 milion rows, the problem was that query was also counting rows every pageload.