3

I have a problem with an inherited MySQL database. From time to time mysqld uses up to 2300% CPU.. The only solution is to service mysql stop and run an myisamchk -r on a table. After the indexes have been fixed, I start MySQL and everything is ok.

Any ideas for an permanent solution?

Edit (from the comments):

Using 5.5.29-0ubuntu0.12.04.2-log

key_buffer = 16M 
max_allowed_packet = 16M 
thread_stack = 128K 
thread_cache_size = 8 
myisam-recover = BACKUP 
max_connections = 500 
#table_cache = 512 
#thread_concurrency = 10 
query_cache_limit = 1M 
query_cache_size = 16M 
SELECT SUM(index_length) ndxsize 
FROM information_schema.tables 
WHERE engine='MyISAM'

returns

+----------+ 
| ndxsize  | 
+----------+
| 59862016 | 
+----------+ 
SELECT SUM(data_length+index_length)/power(1024,2) datndxsize 
FROM information_schema.tables 
WHERE engine='MyISAM'

returns:

+--------------------+ 
| datndxsize         |
+--------------------+
| 488.69915199279785 | 
+--------------------+

The server has 16GB of RAM, but it is not a DB server...It is running nginx + php-fpm

tschelik
  • 55
  • 1
  • 2
  • 8
  • Please run these queries: 1) SELECT VERSION(); 2) SHOW VARIABLES LIKE 'key_buffer_size'; 3) SELECT SUM(index_length) ndxsize FROM information_schema.tables WHERE engine='MyISAM'; 4) How much RAM does the DB Server have? – RolandoMySQLDBA May 06 '13 at 15:56
  • 5.5.29-0ubuntu0.12.04.2-log

  • key_buffer = 16M max_allowed_packet = 16M thread_stack = 128K thread_cache_size = 8 myisam-recover = BACKUP max_connections = 500

  • #table_cache = 512 #thread_concurrency = 10 query_cache_limit = 1M query_cache_size = 16M

    1. +----------+ | ndxsize | +----------+ | 59862016 | +----------+

    2. The server has 16GB of RAM, but it is not a DB server...It is running nginx + php-fpm

    – tschelik May 06 '13 at 20:30
  • Please give me this: SELECT SUM(data_length+index_length)/power(1024,2) datndxsize FROM information_schema.tables WHERE engine='MyISAM'; – RolandoMySQLDBA May 06 '13 at 20:35
  • +--------------------+ | datndxsize | +--------------------+ | 488.69915199279785 | +--------------------+ – tschelik May 06 '13 at 20:37