* Basic Settings#user = mysqlpid-file = /var/run/mysqld/mysqld.pidsocket = /var/run/mysqld/mysqld.sockport = 3306basedir = /usrdatadir = /var/lib/mysqltmpdir = /tmplanguage = /usr/share/mysql/englishskip-external-locking## localhost which is more compatible and is not less secure.#bind-address = 127.0.0.1## * Fine Tuning#key_buffer = 32Mmax_allowed_packet = 1Gthread_stack = 256Kthread_cache_size = 8max_connections = 300table_cache = 512thread_concurrency = 20## * Query Cache Configuration#query_cache_limit = 16Mquery_cache_size = 100K## * Logging and Replication## Both location gets rotated by the cronjob.# Be aware that this log type is a performance killer.#log = /var/log/mysql/mysql.log## Error logging goes to syslog. This is a Debian improvement :)## Here you can see queries with especially long duration#log_slow_queries = /var/log/mysql/mysql-slow.loglong_query_time = 4log-queries-not-using-indexes## The following can be used as easy to replay backup logs or for replication.# note: if you are setting up a replication slave, see README.Debian about# other settings you may need to change.#server-id = 1log_bin = /var/log/mysql/mysql-bin.log# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!expire_logs_days = 5max_binlog_size = 100M#binlog_do_db = include_database_name#binlog_ignore_db = include_database_name## * BerkeleyDB## Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.skip-bdb## * InnoDB## InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.# Read the manual for more InnoDB related options. There are many!# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.#skip-innodb## * Security Features## Read the manual, too, if you want chroot!# chroot = /var/lib/mysql/## For generating SSL certificates I recommend the OpenSSL GUI “tinyca”.## ssl-ca=/etc/mysql/cacert.pem# ssl-cert=/etc/mysql/server-cert.pem# ssl-key=/etc/mysql/server-key.pem[mysqldump]quickquote-namesmax_allowed_packet = 612M[mysql]#no-auto-rehash # faster start of mysql but no tab completition[isamchk]key_buffer = 128M
Some immediate thoughts:
1.
How large is your DB?
Because your setting:
max_allowed_packet = 1G
seems very odd.
It is incredibly huge while the rest of your values are very small.
Post the output from SHOW STATUS so that we can see what your database is actually doing.
Tells us that you have at least one JOIN that doesn’t use an index at all.
| Select_scan | 39636 |
Tells us that about 1/10 of your queries does a table scan.
So I suggest that you turn on the slow query log and start examining what queries ends up there. Because you seem to lack some important indexes in your database.
Another thing that is good to know for you is that if you add the column that you order by as the last column in a combined index the DBMS can use that index to retrieve the rows in sorted order. And that avoids the need for sorting the rows later in the query execution. Although it only works on some types of queries it is worthwhile to check out.
mpm:~# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld…failed.
Please take a look at the syslog.
/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysq ld.sock’ (2)’
Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!
mpm:~# ./tuning-primer.sh – MYSQL PERFORMANCE TUNING PRIMER – - By: Matthew Montgomery -MySQL Version 4.1.15-Debian_0.dotdeb.4-log i386Uptime = 1 days 23 hrs 7 min 5 secAvg. qps = 100Total Questions = 17099276Threads Connected = 180Warning: Server has not been running for at least 48hrs.It may not be safe to use these recommendationsTo find out more information on how each of theseruntime variables effects performance visit:http://dev.mysql.com/doc/refman/4.1/en/server-system-variables.htmlVisithttp://www.mysql.com/products/enterprise/advisors.htmlfor info about MySQL’s Enterprise Monitoring and Advisory ServiceSLOW QUERIESCurrent long_query_time = 4 sec.You have 590528 out of 17110206 that take longer than 4 sec. to completeThe slow query log is NOT enabled.Your long_query_time seems to be fineWORKER THREADSCurrent thread_cache_size = 8Current threads_cached = 7Current threads_per_sec = 0Historic threads_per_sec = 0Your thread_cache_size is fineMAX CONNECTIONSCurrent max_connections = 400Current threads_connected = 171Historic max_used_connections = 277The number of used connections is 69% of the configured maximum.Your max_connections variable seems to be fine.MEMORY USAGEMax Memory Ever Allocated : 3 GConfigured Max Per-thread Buffers : 4 GConfigured Max Global Buffers : 650 MConfigured Max Memory Limit : 5 GPhysical Memory : 1002.26 MMax memory limit exceeds 90% of physical memoryKEY BUFFERCurrent MyISAM index space = 30 MCurrent key_buffer_size = 512 MKey cache miss rate is 1 : 289Key buffer fill ratio = 2.00 %Your key_buffer_size seems to be too high.Perhaps you can use these resources elsewhereQUERY CACHEQuery cache is enabledCurrent query_cache_size = 128 MCurrent query_cache_used = 45 MCurrent query_cache_limit = 1 MCurrent Query cache Memory fill ratio = 35.22 %Current query_cache_min_res_unit = 4 KQuery Cache is 21 % fragmentedRun “FLUSH QUERY CACHE” periodically to defragment the query cache memoryIf you have many small queries lower ‘query_cache_min_res_unit’ to reduce fragmentation.MySQL won’t cache query results that are larger than query_cache_limit in sizeSORT OPERATIONSCurrent sort_buffer_size = 2 MCurrent record/read_rnd_buffer_size = 7 MSort buffer seems to be fineJOINSCurrent join_buffer_size = 132.00 KYou have had 880 queries where a join could not use an index properlyYou 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 yourjoin_buffer_size to accommodate larger joins in one pass.Note! This script will still suggest raising the join_buffer_size whenANY joins not using indexes are found.OPEN FILES LIMITCurrent open_files_limit = 2010 filesThe open_files_limit should typically be set to at least 2x-3xthat of table_cache if you have heavy MyISAM usage.Your open_files_limit value seems to be fineTABLE CACHECurrent table_cache value = 512 tablesYou have a total of 435 tablesYou have 475 open tables.The table_cache value seems to be fineTEMP TABLESCurrent max_heap_table_size = 16 MCurrent tmp_table_size = 32 MOf 760854 temp tables, 0% were created on diskEffective in-memory tmp_table_size is limited to max_heap_table_size.Created disk tmp tables ratio seems fineTABLE SCANSCurrent read_buffer_size = 1 MCurrent table scan ratio = 263 : 1read_buffer_size seems to be fineTABLE LOCKINGCurrent Lock Wait ratio = 1 : 121You may benefit from selective use of InnoDB.If you have long running SELECT’s against MyISAM tables and performfrequent updates consider setting ‘low_priority_updates=1’
OK, you might have indexes but are the queries written so that MySQL can use them?
This figure:
[B]Quote:[/B]
| Handler_read_rnd_next | 336080470215 |
Indicates that you have seem to have a lot of table scans.
Test the queries in your slow query log with the EXPLAIN keyword in front of them and check the execution plan.
If you want help to interpret the output from EXPLAIN you can post it here.