Da ich nicht weiss ob mir einer ein paar Fragen zur MySQL Konfiguration beantworten kann bzw. möchte, frage ich einfach mal darauf los.
Ich habe auf meinem Server (8x 2,4 GHz, 32GB) über TOP folgende Werte:
Code: Select all
top - 22:40:51 up 19 days, 10:25, 2 users, load average: 1.49, 1.22, 1.26
Tasks: 223 total, 1 running, 222 sleeping, 0 stopped, 0 zombie
Cpu(s): 12.2%us, 3.3%sy, 0.0%ni, 83.9%id, 0.5%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 32814400k total, 19592576k used, 13221824k free, 263204k buffers
Swap: 2097136k total, 0k used, 2097136k free, 16192788k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20142 apache 20 0 374m 48m 5712 S 40.9 0.2 0:28.17 httpd
1114 mysql 20 0 4494m 311m 7836 S 30.6 1.0 2948:06 mysqld
14353 apache 20 0 374m 47m 5864 S 9.0 0.1 1:53.54 httpd
7699 apache 20 0 375m 49m 6324 S 8.0 0.2 3:12.27 httpd
18649 apache 20 0 380m 53m 6344 S 6.0 0.2 0:41.54 httpd
16244 apache 20 0 381m 54m 6244 S 5.6 0.2 1:26.43 httpd
15860 apache 20 0 378m 50m 6140 S 4.0 0.2 1:34.92 httpd
16129 apache 20 0 366m 40m 6136 S 3.7 0.1 1:27.41 httpd
21105 apache 20 0 383m 57m 4420 S 3.7 0.2 0:07.62 httpd
19536 apache 20 0 385m 59m 4640 S 2.7 0.2 0:35.10 httpd
15555 apache 20 0 382m 55m 5952 S 2.3 0.2 1:42.62 httpd
20077 apache 20 0 371m 46m 4480 S 2.0 0.1 0:29.45 httpd
20140 apache 20 0 369m 44m 4608 S 2.0 0.1 0:27.32 httpd
12332 apache 20 0 374m 48m 4684 S 1.7 0.2 2:24.73 httpd
19620 apache 20 0 373m 48m 4480 S 1.7 0.2 0:38.86 httpd
21339 apache 20 0 372m 47m 4428 S 1.3 0.1 0:03.60 httpd
1 root 20 0 19352 1548 1244 S 0.0 0.0 0:02.63 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root RT 0 0 0 0 S 0.0 0.0 0:38.16 migration/0
4 root 20 0 0 0 0 S 0.0 0.0 0:00.06 ksoftirqd/0
5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
6 root RT 0 0 0 0 S 0.0 0.0 0:01.38 watchdog/0
Hier mal die Daten von mysqltuner:
Code: Select all
>> MySQLTuner 1.2.0 - 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.5.29-cll
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 80M (Tables: 626)
[--] Data in InnoDB tables: 12M (Tables: 252)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 268
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 7d 1h 39m 30s (87M q [143.785 qps], 5M conn, TX: 209B, RX: 19B)
[--] Reads / Writes: 77% / 23%
[--] Total buffers: 176.0M global + 2.9M per thread (150 max threads)
[OK] Maximum possible memory usage: 607.2M (1% of installed RAM)
[OK] Slow queries: 0% (402/87M)
[OK] Highest usage of available connections: 62% (93/150)
[OK] Key buffer size / total MyISAM indexes: 8.0M/45.7M
[OK] Key buffer hit rate: 100.0% (34B cached / 548K reads)
[OK] Query cache efficiency: 25.6% (14M cached / 55M selects)
[!!] Query cache prunes per day: 23399
[!!] Sorts requiring temporary tables: 13% (1M temp sorts / 10M sorts)
[!!] Joins performed without indexes: 198509
[OK] Temporary tables created on disk: 2% (103K on disk / 3M total)
[OK] Thread cache hit rate: 90% (545K created / 5M connections)
[!!] Table cache hit rate: 1% (400 open / 39K opened)
[OK] Open file limit used: 50% (512/1K)
[OK] Table locks acquired immediately: 98% (122M immediate / 124M locks)
[OK] InnoDB data size / buffer pool: 12.8M/128.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Adjust your join queries to always utilize indexes
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (> 8M)
sort_buffer_size (> 2M)
read_rnd_buffer_size (> 256K)
join_buffer_size (> 256.0K, or always use indexes with joins)
table_cache (> 400)
Code: Select all
MySQL Version 5.5.29-cll x86_64
Uptime = 7 days 1 hrs 51 min 46 sec
Avg. qps = 143
Total Questions = 87965289
Threads Connected = 1
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.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 enabled.
Current long_query_time = 4.000000 sec.
You have 402 out of 87965310 that take longer than 4.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 = 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 = 150
Current threads_connected = 5
Historic max_used_connections = 93
The number of used connections is 62% of the configured maximum.
Your max_connections variable seems to be fine.
INNODB STATUS
Current InnoDB index space = 6 M
Current InnoDB data space = 12 M
Current InnoDB buffer pool free = 80 %
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 : 427 M
Configured Max Per-thread Buffers : 431 M
Configured Max Global Buffers : 160 M
Configured Max Memory Limit : 591 M
Physical Memory : 31.29 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 45 M
Current key_buffer_size = 8 M
Key cache miss rate is 1 : 61517
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 = 8 M
Current query_cache_used = 3 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 44.71 %
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 = 256 K
Sort buffer seems to be fine
JOINS
Current join_buffer_size = 260.00 K
You have had 198767 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 = 1024 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 919 tables
You have 400 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
You should probably increase your table_definition_cache value.
TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 3690761 temp tables, 2% were created on disk
Created disk tmp tables ratio seems fine
TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 911 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 59
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=ALWAYS'.
Code: Select all
[mysqld]
bind-address=127.0.0.1
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
#set-variable = max_connections=150
log-slow-queries
max_connections=150
thread_cache_size = 4
query_cache_size = 8M
query_cache_limit = 2M
join_buffer_size = 256K
read_rnd_buffer_size = 256K
sort_buffer_size = 2M
long_query_time= 4
log-slow-queries=/var/log/mysql_slow.log
Danke vorab und Gruß
Chris