MySQL Forums
Forum List  »  Performance

MySQL Performance Tuning Help
Posted by: Lloyd Silver
Date: October 02, 2010 12:28AM

I just moved over to a new dedicated virtual server (VE) at Media Temple and am in the process of moving over about 10 sites all created in Drupal. The server has 1GB of dedicated RAM with additional shared RAM available. Right now only MyISAM tables are being used (no INNODB).

I've been trying to optimize MySQL. My my.cnf file is basically what I used on my old server with some additional and continuous (so far) tweaking. I've also been using both tuning-primer.sh and mysqltuner.pl to help with the optimization.

Both tuning scripts are suggesting I increase tmp_table_size and max_heap_table_size. I understand that with BLOB and TEXT columns increasing these values won't make a difference. I went up to 250MB and the percentage of tables created on disk remained constant (around 26%) so I don't think increasing the value is going to help. So I've lowered the value to 64M which might still unnecessarily high.

I'm trying to understand proper tuning and would appreciate any feedback in general on my my.cnf file (see below). And I'd also appreciate any insight on my analysis of tmp_table_size and max_heap_table_size.

I've also included the output of the two tuning scripts.

Thanks much.

***my.cnf***
[mysqld]
skip-innodb
query-cache-type = 1
query-cache-size = 48M
max_allowed_packet = 32M
thread-cache-size = 4
table_cache = 1600
key_buffer = 32M
open_files_limit = 3200
max_connections = 50
tmp_table_size = 64M
max_heap_table_size = 64M
join_buffer_size = 2M
read_buffer_size = 1M
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 32M

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

# set-variable = innodb_buffer_pool_size=3M
# set-variable = innodb_additional_mem_pool_size=500K
# set-variable = innodb_log_buffer_size=500K
# set-variable = innodb_thread_concurrency=2
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
skip-bdb

# set-variable = innodb_buffer_pool_size=2M
# set-variable = innodb_additional_mem_pool_size=500K
# set-variable = innodb_log_buffer_size=500K
# set-variable = innodb_thread_concurrency=2

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 64M
sort_buffer = 64M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout




***TUNING-PRIMER***


SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 0 out of 896536 that take longer than 10 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 = 2
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 50
Current threads_connected = 3
Historic max_used_connections = 17
The number of used connections is 34% of the configured maximum.
Your max_connections variable seems to be fine.

No InnoDB Support Enabled!

MEMORY USAGE
Max Memory Ever Allocated : 196 M
Configured Max Per-thread Buffers : 312 M
Configured Max Global Buffers : 90 M
Configured Max Memory Limit : 402 M
Physical Memory : 1.71 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 15 M
Current key_buffer_size = 32 M
Key cache miss rate is 1 : 153
Key buffer free ratio = 65 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 48 M
Current query_cache_used = 36 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 76.17 %
Current query_cache_min_res_unit = 4 K
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 = 1 M
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 2.00 M
You have had 30 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 = 3260 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 = 1600 tables
You have a total of 1087 tables
You have 1110 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 64 M
Current tmp_table_size = 64 M
Of 10973 temp tables, 27% 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 = 1 M
Current table scan ratio = 9 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 6148
Your table locking seems to be fine


***MYSQLTUNER***

>> MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering

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

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 50M (Tables: 1069)
[!!] Total fragmented tables: 24

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 0h 28m 57s (896K q [10.172 qps], 8K conn, TX: 5B, RX: 256M)
[--] Reads / Writes: 59% / 41%
[--] Total buffers: 154.0M global + 6.2M per thread (50 max threads)
[OK] Maximum possible memory usage: 466.5M (26% of installed RAM)
[OK] Slow queries: 0% (0/896K)
[OK] Highest usage of available connections: 34% (17/50)
[OK] Key buffer size / total MyISAM indexes: 32.0M/15.7M
[OK] Key buffer hit rate: 99.3% (2M cached / 14K reads)
[OK] Query cache efficiency: 86.5% (689K cached / 797K selects)
[!!] Query cache prunes per day: 8343
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 18K sorts)
[!!] Temporary tables created on disk: 28% (4K on disk / 15K total)
[OK] Thread cache hit rate: 96% (274 created / 8K connections)
[OK] Table cache hit rate: 41% (1K open / 2K opened)
[OK] Open file limit used: 67% (2K/3K)
[OK] Table locks acquired immediately: 99% (209K immediate / 209K locks)
[!!] Connections aborted: 14%

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Your applications are not closing MySQL connections properly
Variables to adjust:
query_cache_size (> 48M)
tmp_table_size (> 64M)
max_heap_table_size (> 64M)



Edited 1 time(s). Last edit at 10/02/2010 01:16AM by Lloyd Silver.

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Performance Tuning Help
11606
October 02, 2010 12:28AM
2872
October 03, 2010 11:59AM
2079
October 04, 2010 01:00AM
1952
October 04, 2010 08:27AM
1748
October 05, 2010 01:50PM
1693
October 05, 2010 07:31PM
1576
October 05, 2010 07:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.