MySQL Server Crashing need Help


 
Thread Tools Search this Thread
Top Forums Web Development MySQL Server Crashing need Help
# 1  
Old 04-25-2011
MySQL Server Crashing need Help

Hi, we have some problem with mysql high cpu , would like some help with MySQL Tuning
here are the mysqltuner & tuning-primer details
mysqltuner:
Code:
[root@main src]# mysqltuner

 >> MySQLTuner 1.1.1 - Major Hayden <major@mhtx.net>
 >> Run with '--help' for additional options and output filtering

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.56-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 275M (Tables: 654)
[--] Data in InnoDB tables: 35M (Tables: 293)
[!!] Total fragmented tables: 300

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 10h 19m 57s (631K q [16.981 qps], 39K conn, TX: 3B, RX: 102M)
[--] Reads / Writes: 97% / 3%
[--] Total buffers: 906.0M global + 4.6M per thread (500 max threads)
[OK] Maximum possible memory usage: 3.1G (26% of installed RAM)
[OK] Slow queries: 0% (106/631K)
[OK] Highest usage of available connections: 2% (14/500)
[OK] Key buffer size / total MyISAM indexes: 8.0M/59.4M
[OK] Key buffer hit rate: 100.0% (12B cached / 317K reads)
[OK] Query cache efficiency: 68.4% (350K cached / 511K selects)
[!!] Query cache prunes per day: 166830
[OK] Sorts requiring temporary tables: 0% (10 temp sorts / 171K sorts)
[!!] Temporary tables created on disk: 48% (26K on disk / 54K total)
[OK] Thread cache hit rate: 99% (102 created / 39K connections)
[!!] Table cache hit rate: 9% (1K open / 10K opened)
[OK] Open file limit used: 17% (1K/8K)
[OK] Table locks acquired immediately: 99% (206K immediate / 206K locks)
[!!] Connections aborted: 28%
[OK] InnoDB data size / buffer pool: 35.4M/512.0M

-------- Recommendations -----------------------------------------------------
General recommendations:
 Run OPTIMIZE TABLE to defragment tables for better performance
 MySQL started within last 24 hours - recommendations may be inaccurate
 Temporary table size is already large - reduce result set size
 Reduce your SELECT DISTINCT queries without LIMIT clauses
 Increase table_cache gradually to avoid file descriptor limits
 Your applications are not closing MySQL connections properly
Variables to adjust:
 query_cache_size (> 128M)
 table_cache (> 2048)

tuning-primer
Quote:
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.1.56-log x86_64

Uptime = 0 days 10 hrs 17 min 59 sec
Avg. qps = 16
Total Questions = 629952
Threads Connected = 11

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
MySQL :: MySQL 5.1 Reference Manual :: 5.1.3 Server System Variables
Visit MySQL :: MySQL Enterprise Advisors
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is enabled.
Current long_query_time = 10.000000 sec.
You have 105 out of 629973 that take longer than 10.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See MySQL :: MySQL 5.1 Reference Manual :: 6.5 Point-in-Time (Incremental) Recovery Using the Binary Log

WORKER THREADS
Current thread_cache_size = 4
Current threads_cached = 2
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 500
Current threads_connected = 11
Historic max_used_connections = 14
The number of used connections is 2% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 2 M
Current InnoDB data space = 35 M
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 512 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 714 M
Configured Max Per-thread Buffers : 2.25 G
Configured Max Global Buffers : 649 M
Configured Max Memory Limit : 2.89 G
Physical Memory : 11.72 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 59 M
Current key_buffer_size = 7 M
Key cache miss rate is 1 : 38354
Key buffer free ratio = 0 %
You could increase key_buffer_size
It is safe to raise this up to 1/4 of total system memory;
assuming this is a dedicated database server.

QUERY CACHE
Query cache is enabled
Current query_cache_size = 128 M
Current query_cache_used = 113 M
Current query_cache_limit = 20 M
Current Query cache Memory fill ratio = 88.81 %
Current query_cache_min_res_unit = 4 K
However, 71728 queries have been removed from the query cache due to lack of memory
Perhaps you should raise query_cache_size
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 1 queries where a join could not use an index properly
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 8192 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_open_cache = 2048 tables
Current table_definition_cache = 1024 tables
You have a total of 970 tables
You have 1012 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 256 M
Current tmp_table_size = 256 M
Of 28441 temp tables, 48% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 526 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 29379
Your table locking seems to be fine
/etc/my.cnf
Code:
[mysqld]
set-variable=local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
query_cache_size = 512M
join_buffer_size = 2M
thread_cache_size = 4
table_cache = 4096
table_definition_cache = 1024
query_cache_limit = 20M
#skip-bdb
long_query_time = 10
log-slow-queries = /var/log/mysql-slow.log
tmpdir = /var/lib/mysql/tmp
max_connections = 500
max_user_connections = 10
tmp_table_size = 256M
max_heap_table_size = 256M
innodb_buffer_pool_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
key_buffer = 16M
myisam_sort_buffer_size = 32M
read_buffer_size = 2M
sort_buffer_size = 2M
interactive_timeout = 25
wait_timeout = 1000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 10
query_cache_type = 1
skip-innodb
[mysqld_safe]
open_files_limit = 8192
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer = 32M
sort_buffer = 32M
read_buffer = 16M
write_buffer = 16M
[mysqlhotcopy]
interactive-timeout A

Thank you.

Last edited by Scott; 04-25-2011 at 06:06 AM..
# 2  
Old 05-01-2011
It is difficult to pinpoint the problem without knowing much about your setup. What exactly do you mean by a crash? Is it hardware related because of mysql or does only mysql crash? Did you run top prior to a crash? Is the crash repeatable?
I also noticed the following: Temporary table size is already large - reduce result set size.
Just want to make sure that you are not writing temporary tables into a user file system where they do not belong?
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Mysql for HP-UX server

Gd evening I am trying to run my website made in php-mysql on a HP-UX system but dont know how to install and run services of Mysql. Kindly provide appropriate solution. thanks in advance. (1 Reply)
Discussion started by: kumar.ashishcs
1 Replies

2. UNIX and Linux Applications

MySQL optimization or why the server is worsened

Hello Please advise me how can I optimize my MySQL server. Or advise which way to look. Maybe someone had similar problems? Over the past two weeks the MySQL server dropped 2 times. I began searching for ways to optimize the server. Overall the picture like that: There is a separate... (2 Replies)
Discussion started by: sergibondarenko
2 Replies

3. Linux

mysql server start issue

Hi, I have installed mysql in linux box as mysql-5.0.77-4.el5_6.6.. I would like to start the server. But there is no mysql file in this location /etc/init.d/ Please advice how to start the server now !! Thnaks, Mani (5 Replies)
Discussion started by: Mani_apr08
5 Replies

4. Shell Programming and Scripting

Trying to connect MYSQL server from HP-UX

Hi everyone, I have an urgent requirement to get some table data from Linux-MYSQL server from HP-UX with oracle database.Is there any way we can get connected through Shell script from HP-UX and issue select on mysql to get some table data? Please help me out. (7 Replies)
Discussion started by: kashik786
7 Replies

5. Red Hat

Multiple crontab entries crashing server

Hi all I have a problem where having multiple simultaneous startups in the crontab causes the entire server (running RHEL-AS3). Three process are set to be fired off at the same minute. Individually, they all start fine. As soon as they start via these cron jobs, the server halts. Doesn't turn... (2 Replies)
Discussion started by: alexandicity
2 Replies

6. Linux

MySQL server connetction problem

Hello,thanks for your help. I can't connect my MYSQLserver , the note from my Linux System is 'Error 1130 (00000): Host 'my ip address' is not allowed to connect to this MySQL server. What could I do on this? Thanks again! (4 Replies)
Discussion started by: lancepanda
4 Replies
Login or Register to Ask a Question