Hi All,
my cpu load is always high and my LA is between 1 to 4
I want to optimize the same for performance, coz 4 months back, i had about 100+ visitors real time on my website with a traffic of 15000+ per day and now i just have about 30 - 40 visitors and also the website goes down at times for some time and i have to restart mysql.
I have multiple Databases and making use of max myisam and min of innodb tables
Any help would be appreciated please
My server config as below
HP DL 120 G7, Single Proc Quad Core
- Intel Xeon E1220 (1 CPU x 4 Cores)
- 500 GB x 2 SATA Hard Disks on Raid 1
- 16 GB DDRII ECC Registered RAM
my.cnf as below
=================
mysqlunner resutls
my cpu load is always high and my LA is between 1 to 4
I want to optimize the same for performance, coz 4 months back, i had about 100+ visitors real time on my website with a traffic of 15000+ per day and now i just have about 30 - 40 visitors and also the website goes down at times for some time and i have to restart mysql.
I have multiple Databases and making use of max myisam and min of innodb tables
Any help would be appreciated please
My server config as below
HP DL 120 G7, Single Proc Quad Core
- Intel Xeon E1220 (1 CPU x 4 Cores)
- 500 GB x 2 SATA Hard Disks on Raid 1
- 16 GB DDRII ECC Registered RAM
my.cnf as below
Code:
[mysqld]
local-infile=0
skip-name-resolve
max_connections=600
low_priority_updates=1
myisam-recover=backup,force
thread_concurrency=8
concurrent_insert=2
thread_cache_size=48
max_allowed_packet=8M
innodb_buffer_pool_size=512M
innodb_additional_mem_pool_size=10M
innodb_flush_method=O_DIRECT
symbolic-links=0
socket=/var/lib/mysql/mysql.sock
interactive_timeout = 100
connect_timeout = 60
wait_timeout = 120
tmp_table_size = 256M
max_heap_table_size = 256M
join_buffer_size=2M
read_buffer_size=4M
sort_buffer_size=2M
table_open_cache=1024
read_rnd_buffer_size=2M
key_buffer =2G
max_allowed_packet=8M
max_connect_errors=10
myisam_sort_buffer_size=64M
query_cache_limit=3M
query_cache_size=1G
query_cache_type=1
open_files_limit=4466
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer=128M
sort_buffer=128M
read_buffer=4M
write_buffer=2M
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 4M
write_buffer = 2M
mysqlunner resutls
Code:
-----------------
-------- General Statistics ----------------------------------------- ---------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.70-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics ---------------------------------- ---------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 2G (Tables: 676)
[--] Data in InnoDB tables: 137M (Tables: 85)
[!!] Total fragmented tables: 98
-------- Security Recommendations ---------------------------------- ---------
[OK] All database users have passwords assigned
-------- Performance Metrics ---------------------------------------- ---------
[--] Up for: 6h 16m 36s (5M q [246.189 qps], 28K conn, TX: 8B, RX: 1B )
[--] Reads / Writes: 83% / 17%
[--] Total buffers: 3.8G global + 10.2M per thread (600 max threads)
[OK] Maximum possible memory usage: 9.8G (62% of installed RAM)
[OK] Slow queries: 0% (60/5M)
[OK] Highest usage of available connections: 5% (35/600)
[OK] Key buffer size / total MyISAM indexes: 2.0G/1.1G
[OK] Key buffer hit rate: 100.0% (749M cached / 39K reads)
[OK] Query cache efficiency: 84.1% (4M cached / 5M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 79K sorts)
[!!] Joins performed without indexes: 455
[!!] Temporary tables created on disk: 29% (29K on disk / 100K total)
[OK] Thread cache hit rate: 99% (35 created / 28K connections)
[OK] Table cache hit rate: 98% (460 open / 467 opened)
[OK] Open file limit used: 13% (610/4K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
[OK] InnoDB data size / buffer pool: 137.7M/512.0M
-------- Recommendations -------------------------------------------- ---------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inacc urate
Enable the slow query log to troubleshoot bad queries
Adjust your join queries to always utilize indexes
Temporary table size is already large - reduce result set size
Reduce your SELECT DISTINCT queries without LIMIT clauses
Variables to adjust:
join_buffer_size (> 2.0M, or always use indexes with joins)
==================
tuning-primer.sh results as below
-------------------------------
SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 60 out of 5611712 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 [url=http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html]MySQL :: MySQL 5.1 Reference Manual :: 7.5 Point-in-Time (Incremental) Recovery Using the Binary Log[/url]
WORKER THREADS
Current thread_cache_size = 48
Current threads_cached = 30
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 600
Current threads_connected = 4
Historic max_used_connections = 35
The number of used connections is 5% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating
INNODB STATUS
Current InnoDB index space = 22 M
Current InnoDB data space = 137 M
Current InnoDB buffer pool free = 92 %
Current innodb_buffer_pool_size = 512 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 : 3.86 G
Configured Max Per-thread Buffers : 6.00 G
Configured Max Global Buffers : 3.51 G
Configured Max Memory Limit : 9.51 G
Physical Memory : 15.64 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 1.12 G
Current key_buffer_size = 2.00 G
Key cache miss rate is 1 : 18978
Key buffer free ratio = 79 %
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 = 1.00 G
Current query_cache_used = 606 M
Current query_cache_limit = 3 M
Current Query cache Memory fill ratio = 59.25 %
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 = 2 M
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 2.00 M
You have had 76 queries where a join could not use an index properly
You have had 379 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 = 4466 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 = 1024 tables
Current table_definition_cache = 256 tables
You have a total of 784 tables
You have 1024 open tables.
Current table_cache hit rate is 95%
, 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 = 256 M
Current tmp_table_size = 256 M
Of 71818 temp tables, 29% 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 = 4 M
Current table scan ratio = 448 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 2558
You may benefit from selective use of InnoDB.
======================