|
|||||
|
|
|||||
![]() Certifications ![]() Cisco ![]() IP ![]() PC ![]() Protocols ![]() RemoteAccess ![]() Resources ![]() Security ![]() Telecommunications ![]() Tools ![]() Unix ![]() Web ![]() mindterm |
I was searching the internet for pointers on tuning my MySQL server at work and ran across 2 different tuning scripts. The first is this wonderful script from http://www.day32.com/MySQL/. Simply save it to your sql server and ensure it is executable. A brief description from the author's website is:
Below is showing the results after a few rounds of tuning on my server.
[tethys]:/home/rnejdl/Scripts> ./tuning-primer.sh
mysqld is alive
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 5.0.75 i386
Uptime = 7 days 2 hrs 29 min 21 sec
Avg. qps = 1
Total Questions = 638990
Threads Connected = 1
Server has been running for over 48hrs.
It should be safe to follow these recommendations
To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service
SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 5 sec.
You have 0 out of 639011 that take longer than 5 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 http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html
WORKER THREADS
Current thread_cache_size = 4
Current threads_cached = 3
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 35
Current threads_connected = 1
Historic max_used_connections = 24
The number of used connections is 68% of the configured maximum.
Your max_connections variable seems to be fine.
MEMORY USAGE
Max Memory Ever Allocated : 160 M
Configured Max Per-thread Buffers : 166 M
Configured Max Global Buffers : 46 M
Configured Max Memory Limit : 212 M
Physical Memory : 1.99 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 39 M
Current key_buffer_size = 4 M
Key cache miss rate is 1 : 4642
Key buffer fill ratio = 8.00 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere
QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 8 K
Current query_cache_limit = 2 K
Current Query cache Memory fill ratio = .02 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won't cache query results that are larger than query_cache_limit in size
SORT OPERATIONS
Current sort_buffer_size = 4 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly
OPEN FILES LIMIT
Current open_files_limit = 11095 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_cache value = 750 tables
You have a total of 608 tables
You have 609 open tables.
The table_cache value seems to be fine
TEMP TABLES
Current max_heap_table_size = 192 M
Current tmp_table_size = 192 M
Of 551 temp tables, 23% were created on disk
Created disk tmp tables ratio seems fine
TABLE SCANS
Current read_buffer_size = 256 K
Current table scan ratio = 22 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 254749
Your table locking seems to be fine
I've tested this on my home server and it has successfully recommended a much smaller memory foot print (although the photo album can peak my SQL traffic). I've also tested on my server at work which averages at around 100 queries per second (qps). The suggested changes were all great and did measurably increase the speed of SQL or limit wasteful use of memory. The second is mysqltuner.pl which easily enough can be retrieved as such:
wget mysqltuner.pl Very nice domain! Simply download it and then chmod it to 755 and execute it. Output looks as such: [tethys]:/home/rnejdl> ./mysqltuner.pl >> MySQLTuner 1.0.0 - Major Hayden This script advises differently from the first. First, it points to the number of tables that need to be defragmented. If you need to defragment your databases, this is the syntax I use: mysqlcheck -or -A -u USERNAME --password=PASSWORD The above will optimze and repair all of your databases as best as possible. Some other adjustments this had me make was to increase the size of my queries that can be cached as well as increase my table cache size. Both tools together seem to work well together. As I find more, I'll udpate this article with any more suggestions I find. This page was created in 0.00126 seconds
Comments and Questions
Last modified: March 30 2009. |
||||