Hello,
I really need some advice about MySQL optimizations. I have Xeon 3210 4GB RAM server and I have MySQL performance problem.
WHM 11.26.20
CENTOS 5.5 x86_64 standard
Processor #1 Name: Intel(R) Xeon(R) CPU X3210 @ 2.13GHz
4GB RAM
I installed two performance tuning script.
1- MySQLTuner 1.0.1 - Major Hayden
2- MySQL Performance Tuning primer - Matthew Montgomery
- This is a MySQLTuner 1.0.1 - Major Hayden report;
Code:root@venus [/]# ./mysqltuner.pl >> 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-log [OK] Operating on 64-bit architecture -------- Storage Engine Statistics ------------------------------------------- [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 3G (Tables: 9308) [--] Data in InnoDB tables: 608K (Tables: 34) [--] Data in MEMORY tables: 29M (Tables: 109) [!!] Total fragmented tables: 460 -------- Performance Metrics ------------------------------------------------- [--] Up for: 3d 0h 29m 55s (26M q [102.628 qps], 982K conn, TX: 1039B, RX: 6B) [--] Reads / Writes: 80% / 20% [--] Total buffers: 314.0M global + 12.4M per thread (200 max threads) [OK] Maximum possible memory usage: 2.7G (72% of installed RAM) [OK] Slow queries: 0% (821/26M) [OK] Highest usage of available connections: 22% (44/200) [OK] Key buffer size / total MyISAM indexes: 256.0M/1.1G [OK] Key buffer hit rate: 99.6% (2B cached / 9M reads) [OK] Query cache efficiency: 42.7% (8M cached / 20M selects) [!!] Query cache prunes per day: 2340609 [OK] Sorts requiring temporary tables: 10% (207K temp sorts / 1M sorts) [!!] Joins performed without indexes: 18194 [!!] Temporary tables created on disk: 31% (411K on disk / 1M total) [OK] Thread cache hit rate: 99% (5K created / 982K connections) [!!] Table cache hit rate: 0% (512 open / 805K opened) [OK] Open file limit used: 2% (1K/50K) [OK] Table locks acquired immediately: 99% (19M immediate / 19M locks) [OK] InnoDB data size / buffer pool: 608.0K/8.0M -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Enable the slow query log to troubleshoot bad queries Adjust your join queries to always utilize indexes When making adjustments, make tmp_table_size/max_heap_table_size equal Reduce your SELECT DISTINCT queries without LIMIT clauses Increase table_cache gradually to avoid file descriptor limits Variables to adjust: query_cache_size (> 32M) join_buffer_size (> 128.0K, or always use indexes with joins) tmp_table_size (> 32M) max_heap_table_size (> 16M) table_cache (> 512)
- This is a MySQL Performance Tuning primer - Matthew Montgomery report:
And This is a my my.cnf settings:Code:root@venus [/]# sh tuning-primer.sh -- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery - MySQL Version 5.0.91-community-log x86_64 Uptime = 3 days 0 hrs 21 min 45 sec Avg. qps = 102 Total Questions = 26761026 Threads Connected = 3 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 = 4 sec. You have 782 out of 26761067 that take longer than 4 sec. to complete Your long_query_time seems to be fine BINARY UPDATE LOG The binary update log is enabled The expire_logs_days is not set. The mysqld will retain the entire binary log until RESET MASTER or PURGE MASTER LOGS commands are run manually Setting expire_logs_days will allow you to remove old binary logs automatically See http://dev.mysql.com/doc/refman/5.0/en/purge-master-logs.html Binlog sync is not enabled, you could loose binlog records during a server crash WORKER THREADS Current thread_cache_size = 8 Current threads_cached = 7 Current threads_per_sec = 0 Historic threads_per_sec = 0 Your thread_cache_size is fine MAX CONNECTIONS Current max_connections = 200 Current threads_connected = 2 Historic max_used_connections = 44 The number of used connections is 22% of the configured maximum. Your max_connections variable seems to be fine. INNODB STATUS Current InnoDB index space = 192 K Current InnoDB data space = 608 K Current InnoDB buffer pool free = 83 % Current innodb_buffer_pool_size = 8 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 : 843 M Configured Max Per-thread Buffers : 2.42 G Configured Max Global Buffers : 298 M Configured Max Memory Limit : 2.71 G Physical Memory : 3.74 G Max memory limit seem to be within acceptable norms KEY BUFFER Current MyISAM index space = 1.11 G Current key_buffer_size = 256 M Key cache miss rate is 1 : 249 Key buffer free ratio = 81 % Your key_buffer_size seems to be fine QUERY CACHE Query cache is enabled Current query_cache_size = 32 M Current query_cache_used = 18 M Current query_cache_limit = 16 M Current Query cache Memory fill ratio = 58.42 % 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 = 8 M Sort buffer seems to be fine JOINS Current join_buffer_size = 132.00 K You have had 18178 queries where a join could not use an index properly You have had 1 joins without keys that check for key usage after each row 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 = 50000 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 = 512 tables You have a total of 9468 tables You have 512 open tables. Current table_cache hit rate is 0% , while 100% of your table cache is in use You should probably increase your table_cache TEMP TABLES Current max_heap_table_size = 16 M Current tmp_table_size = 32 M Of 893793 temp tables, 31% were created on disk Effective in-memory tmp_table_size is limited to max_heap_table_size. 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 = 2 M Current table scan ratio = 6146 : 1 You have a high ratio of sequential access requests to SELECTs You may benefit from raising read_buffer_size and/or improving your use of indexes. TABLE LOCKING Current Lock Wait ratio = 1 : 962 You may benefit from selective use of InnoDB. If you have long running SELECT's against MyISAM tables and perform frequent updates consider setting 'low_priority_updates=1' If you have a high concurrency of inserts on Dynamic row-length tables consider setting 'concurrent_insert=2'.
Code:root@venus [~]# cat /etc/my.cnf [client] port = 3306 socket = /var/lib/mysql/mysql.sock [mysqld] port = 3306 socket = /var/lib/mysql/mysql.sock local-infile=0 set-variable = local-infile=0 skip-locking max_connections = 200 key_buffer = 256M long_query_time = 4 open_files_limit= 50000 max_allowed_packet = 1M table_cache = 512 sort_buffer_size = 2M read_buffer_size = 2M read_rnd_buffer_size = 8M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size = 32M query_cache_limit = 16M thread_concurrency = 8 #skip-networking # Disable Federated by default skip-federated log-bin=mysql-bin server-id = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [isamchk] key_buffer = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M [myisamchk] key_buffer = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout
What Can I do? Please give me some advise.
Thank you very much,
p.s: I'm so sorry, My English is not good.



LinkBack URL
About LinkBacks
Reply With Quote






