mysql server optimieren

Alex007

New Member
Hallo,

ich habe zwei Blogs (wordpress), ein Blog hat viele tausende Artikel.
Wenn ich etwas Suche oder Beiträge lösche, dann dauert das schon ne gewisse Zeit (paar Sekunden).

Ich denke mit einer optimalen Mysql-Konfiguration sollte sich das ja beheben lassen.

Server hat genug Leistung (32GB Ram)

Meine my.cnf


key_buffer = 7750M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
max_heap_table_size = 512M
tmp_table_size = 512M
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
max_connections = 1500
#table_cache = 64555
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 4M
query_cache_size = 320M




Wordpress DB ist etwa 1.5GB groß.

Hoffe auf Hilfe. Danke im Voraus.
 
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.31-0+wheezy1
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 1G (Tables: 39)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] InnoDB is enabled but isn't being used
[!!] Total fragmented tables: 5

-------- Security Recommendations -------------------------------------------
[!!] User '@localhost' has no password set.


-------- Performance Metrics -------------------------------------------------
[--] Up for: 33m 21s (3M q [1K qps], 6K conn, TX: 4B, RX: 234M)
[--] Reads / Writes: 97% / 3%
[--] Total buffers: 8.5G global + 2.7M per thread (1500 max threads)
[OK] Maximum possible memory usage: 12.5G (39% of installed RAM)
[OK] Slow queries: 0% (0/3M)
[OK] Highest usage of available connections: 2% (33/1500)
[OK] Key buffer size / total MyISAM indexes: 7.6G/279.5M
[OK] Key buffer hit rate: 99.9% (65M cached / 90K reads)
[OK] Query cache efficiency: 92.3% (3M cached / 3M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 1% (154 temp sorts / 8K sorts)
[!!] Temporary tables created on disk: 36% (4K on disk / 11K total)
[OK] Thread cache hit rate: 98% (66 created / 6K connections)
[OK] Table cache hit rate: 23% (125 open / 532 opened)
[OK] Open file limit used: 2% (171/7K)
[OK] Table locks acquired immediately: 99% (268K immediate / 268K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Add skip-innodb to MySQL configuration to disable InnoDB
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
Temporary table size is already large - reduce result set size
Reduce your SELECT DISTINCT queries without LIMIT clauses


und prime:

MySQL Version 5.5.31-0+wheezy1 x86_64

Uptime = 0 days 0 hrs 34 min 38 sec
Avg. qps = 1655
Total Questions = 3440519
Threads Connected = 2

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10.000000 sec.
You have 0 out of 3440540 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 = 8
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 = 1500
Current threads_connected = 3
Historic max_used_connections = 33
The number of used connections is 2% 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 = 0 bytes
Current InnoDB data space = 0 bytes
Current InnoDB buffer pool free = 98 %
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 : 8.10 G
Configured Max Per-thread Buffers : 3.93 G
Configured Max Global Buffers : 8.02 G
Configured Max Memory Limit : 11.95 G
Physical Memory : 31.17 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 279 M
Current key_buffer_size = 7.56 G
Key cache miss rate is 1 : 720
Key buffer free ratio = 80 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 320 M
Current query_cache_used = 191 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 59.93 %
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 = 132.00 K
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 = 7500 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 80 tables
You have 125 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 512 M
Current tmp_table_size = 512 M
Of 7982 temp tables, 35% 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 = 128 K
Current table scan ratio = 143 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 3917
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'.
 
Abgesehen von einem überdimensionierten key_buffer, lässt sich nicht viel sagen. Die Warnung zur Laufzeit vom tuning-primer hast Du gelesen? Eine statistische Auswertung ist einfach erst nach einem gewissen Zeitraum möglich.

Aber ich tippe mal darauf, dass Du von einer Umstellung auf InnoDB profitieren würdest. Die Tabellen scheinen alle MyIsam zu sein.

huschi.
 
Die Frage ist ob der MySQL überhaupt an der Verzögerung schuld ist, oder ob die Aufbereitung durch Wordpress so lange dauert.

Du kannst das ja mal Testen und von Hand eine Query abschicken, z.B. so etwas:

Code:
select post_name,post_date from wp_posts where post_content like '%Twitter%';

wp_ musst du durch deinen eigenen Table-Prefix ersetzen, so abweichend. Das Suchwort logischerweise auch :-)
 
ich denke schon, dass die DB schuld ist. Weil auf anderen Blog, wo nicht so viele Beiträge vorhanden sind, geht es ziemlich schnell. Und wo die DB bei dem anderen Blog nicht so groß war, ging auch alles schnell.

Habe jetzt paar Tage mysql-server laufen lassen:

QUERY CACHE
Query cache is enabled
Current query_cache_size = 256 M
Current query_cache_used = 227 M
Current query_cache_limit = 4 M
Current Query cache Memory fill ratio = 88.69 %
Current query_cache_min_res_unit = 4 K
However, 1430808 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


TEMP TABLES
Current max_heap_table_size = 1.97 G
Current tmp_table_size = 1.97 G
Of 1038733 temp tables, 37% 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.


-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 1G (Tables: 39)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] InnoDB is enabled but isn't being used
[!!] Total fragmented tables: 4

-------- Security Recommendations -------------------------------------------
[!!] User '@localhost' has no password set.

-------- Performance Metrics -------------------------------------------------
[--] Up for: 4d 2h 24m 31s (331M q [934.839 qps], 863K conn, TX: 506B, RX: 24B)
[--] Reads / Writes: 96% / 4%
[--] Total buffers: 9.9G global + 2.7M per thread (1500 max threads)
[OK] Maximum possible memory usage: 13.9G (44% of installed RAM)
[OK] Slow queries: 0% (6/331M)
[OK] Highest usage of available connections: 3% (57/1500)
[OK] Key buffer size / total MyISAM indexes: 7.6G/284.5M
[OK] Key buffer hit rate: 100.0% (5B cached / 2M reads)
[OK] Query cache efficiency: 90.9% (296M cached / 326M selects)
[!!] Query cache prunes per day: 348957
[OK] Sorts requiring temporary tables: 1% (14K temp sorts / 1M sorts)
[!!] Temporary tables created on disk: 37% (619K on disk / 1M total)
[OK] Thread cache hit rate: 99% (1K created / 863K connections)
[!!] Table cache hit rate: 13% (205 open / 1K opened)
[OK] Open file limit used: 3% (251/7K)
[OK] Table locks acquired immediately: 99% (32M immediate / 32M locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Add skip-innodb to MySQL configuration to disable InnoDB
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
Increasing the query_cache size over 128M may reduce performance
Temporary table size is already large - reduce result set size
Reduce your SELECT DISTINCT queries without LIMIT clauses
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
query_cache_size (> 256M) [see warning above]
table_cache (> 400)
 
ich denke schon, dass die DB schuld ist. Weil auf anderen Blog, wo nicht so viele Beiträge vorhanden sind, geht es ziemlich schnell. Und wo die DB bei dem anderen Blog nicht so groß war, ging auch alles schnell.

Den einzigen Rückschluss den Du hier ziehen kannst ist:

bei vielen Daten langsam, bei wenig Daten schnell.

Wo die Bremse liegt lässt sich daraus nicht erschliessen. Natürlich kann es an MySQL liegen, es kann aber auch eine nachgelagerte Stelle sein die dann die Daten verarbeiten muss.

Nehmen wir mal den denkbar ungünstigsten Zustand, Wordpress macht einfach 'SELECT * FROM wp_posts' und sucht/sortiert dann selber.

[OK] Slow queries: 0% (6/331M)

Wie groß ist denn dein
Code:
long_query_time
?

Richtig viele slow Queries (6 an der Zahl) scheint das System ja nicht zu haben.
 
Back
Top