Linux penguin1

Optimizing my.cnf in new server

I just optimized my MySQL server (mysql Ver 14.12 Distrib 5.0.51a, for redhat-linux-gnu (x86_64) using readline 5.0
).
I was using mysqltuner.pl and tuning-primer.sh to optimize.
It can be download in the following links below.

mysqltuner.pl
[adrotate banner=”2″]
tuning-primer.sh

Here is the settings from my.cnf

[root@server src]# cat /etc/my.cnf
[mysqld]
local-infile=0
skip-locking
query_cache_limit=4M
query_cache_size=32M
query_cache_type=1
max_connections=500
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_cache_size=128
key_buffer=16M
key_buffer_size=256M
join_buffer=1M
join_buffer_size=1M
max_allowed_packet=16M
table_cache=2048
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
max_connect_errors=10
# Try number of CPU’s*2 for thread_concurrency
thread_concurrency=8
myisam_sort_buffer_size=64M
server-id=1
tmp_table_size=64M
max_heap_table_siz=64M
innodb_buffer_pool_size=128M

[safe_mysqld]
err-log=/var/log/mysqld.log
open_files_limit=8192

[mysqldump]
quick
max_allowed_packet=16M

[mysql]
no-auto-rehash
#safe-updates

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

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

[mysqlhotcopy]
interactive-timeout

Linux penguin1
Here is the results from mysqltuner.pl

[root@server src]# ./mysqltuner.pl

>> MySQLTuner 1.2.0 – Major Hayden
>> 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.51a-community
[OK] Operating on 64-bit architecture

——– Storage Engine Statistics ——————————————-
[–] Status: +Archive -BDB +Federated +InnoDB -ISAM -NDBCluster
[–] Data in MyISAM tables: 795M (Tables: 1641)
[–] Data in InnoDB tables: 72M (Tables: 118)
[–] Data in MEMORY tables: 0B (Tables: 6)
[!!] Total fragmented tables: 8

——– Security Recommendations ——————————————-
[OK] All database users have passwords assigned

——– Performance Metrics ————————————————-
[–] Up for: 10m 21s (7K q [12.483 qps], 735 conn, TX: 16M, RX: 1M)
[–] Reads / Writes: 85% / 15%
[–] Total buffers: 482.0M global + 5.5M per thread (500 max threads)
[OK] Maximum possible memory usage: 3.2G (81% of installed RAM)
[OK] Slow queries: 0% (0/7K)
[OK] Highest usage of available connections: 0% (3/500)
[OK] Key buffer size / total MyISAM indexes: 256.0M/183.2M
[OK] Key buffer hit rate: 97.3% (168K cached / 4K reads)
[OK] Query cache efficiency: 39.4% (1K cached / 4K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (1 temp sorts / 368 sorts)
[OK] Temporary tables created on disk: 21% (166 on disk / 785 total)
[OK] Thread cache hit rate: 99% (3 created / 735 connections)
[OK] Table cache hit rate: 99% (1K open / 1K opened)
[OK] Open file limit used: 72% (3K/4K)
[OK] Table locks acquired immediately: 100% (4K immediate / 4K locks)
[OK] InnoDB data size / buffer pool: 72.0M/128.0M

——– Recommendations —————————————————–
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours – recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries

Here is the result of tuning-primer.sh

[root@server src]# ./tuning-primer.sh

— MYSQL PERFORMANCE TUNING PRIMER —
– By: Matthew Montgomery –

MySQL Version 5.0.51a-community x86_64

Uptime = 0 days 0 hrs 11 min 3 sec
Avg. qps = 12
Total Questions = 8041
Threads Connected = 1

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.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 = 10 sec.
You have 0 out of 8062 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 = 128
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 = 500
Current threads_connected = 1
Historic max_used_connections = 3
The number of used connections is 0% 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 = 32 M
Current InnoDB data space = 72 M
Current InnoDB buffer pool free = 61 %
Current innodb_buffer_pool_size = 128 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 : 434 M
Configured Max Per-thread Buffers : 2.68 G
Configured Max Global Buffers : 418 M
Configured Max Memory Limit : 3.08 G
Physical Memory : 3.85 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 183 M
Current key_buffer_size = 256 M
Key cache miss rate is 1 : 38
Key buffer free ratio = 80 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 4 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 13.23 %
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 = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 1.00 M
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 = 4606 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 = 2048 tables
You have a total of 1782 tables
You have 1795 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 800 temp tables, 18% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 29 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 8326
Your table locking seems to be fine

[adrotate banner=”1″]
Here are the current results, I will re-check the settings after get the statistic from MySQL for 1 week.

Tags:

2 thoughts on “Optimizing my.cnf in new server”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.