http://turnkeye.com/blog/magento-performance-optimize-mysql/
http://www.crucialwebhost.com/kb/improving-magento-performance-with-mysql-query-cache/
vi /etc/my.cnf
default-storage-engine=MyISAM
interactive_timeout=300
key_cache_block_size=4096
key_buffer_size=52428800
max_heap_table_size=32M
max_join_size=1000000000
max_allowed_packet=268435456
open_files_limit=4096
query_cache_size=64M
thread_cache_size=100
tmp_table_size=32M
wait_timeout=7200
max_user_connections=1000
myisam_recover_options=FORCE
innodb_file_per_table=1
innodb_flush_log_at_trx_commit=0
innodb_purge_threads=1
innodb_support_xa=0
innodb_thread_concurrency=8
pid-file="/var/lib/mysql/mysqld.pid"
#innodb_buffer_pool_size=134217728
innodb_additional_mem_pool_size=31457280
innodb_buffer_pool_size=335544320
innodb_lock_wait_timeout=1000
#foreign_key_checks=0
http://turnkeye.com/blog/magento-performance-optimize-mysql/
root@server.sherrydresses.com [public_html]# ./tuning-primer.sh
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 5.5.40-cll x86_64
Uptime = 0 days 0 hrs 17 min 11 sec
Avg. qps = 914
Total Questions = 942761
Threads Connected = 24
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:
http://dev.mysql.com/doc/refman/5.5/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 = 10.000000 sec.
You have 11 out of 943815 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 http://dev.mysql.com/doc/refman/5.5/en/point-in-time-recovery.html
WORKER THREADS
Current thread_cache_size = 100
Current threads_cached = 6
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 151
Current threads_connected = 25
Historic max_used_connections = 30
The number of used connections is 19% of the configured maximum.
Your max_connections variable seems to be fine.
INNODB STATUS
Current InnoDB index space = 8.75 G
Current InnoDB data space = 34.11 G
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 320 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 : 560 M
Configured Max Per-thread Buffers : 415 M
Configured Max Global Buffers : 472 M
Configured Max Memory Limit : 887 M
Physical Memory : 15.57 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 12 M
Current key_buffer_size = 50 M
Key cache miss rate is 1 : 1468
Key buffer free ratio = 94 %
Your key_buffer_size seems to be fine
QUERY CACHE
Query cache is enabled
Current query_cache_size = 64 M
Current query_cache_used = 55 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 87.44 %
Current query_cache_min_res_unit = 4 K
However, 276061 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 = 132.00 K
You have had 74 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 = 4096 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 = 400 tables
Current table_definition_cache = 400 tables
You have a total of 1301 tables
You have 400 open tables.
Current table_cache hit rate is 4%
, while 100% of your table cache is in use
You should probably increase your table_cache
You should probably increase your table_definition_cache value.
TEMP TABLES
Current max_heap_table_size = 32 M
Current tmp_table_size = 32 M
Of 150920 temp tables, 15% were created on disk
Created disk tmp tables ratio seems fine
TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 66 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 1066871
Your table locking seems to be fine