Delmus 0 Zgłoś post Napisano Wrzesień 10, 2013 Witam, planowałem optymalizacje serwera baz danych od dłuższego czasu programem tuning-primer. Uptime serwera trwa ponad 14 dni, więc wyniki raczej powinny być rzetelne. Jednak nie chciałbym popełnić żadnej gafy przy zmianie wartości oraz przy ewentualnych innych rzeczach co radzi program, więc proszę o "rozszyfrowanie" co program przekazuje i zaproponowanie optymalnych wartości. -- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery - MySQL Version 5.1.66-0+squeeze1-log i486 Uptime = 14 days 4 hrs 11 min 14 sec Avg. qps = 3 Total Questions = 4608708 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.1/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 = 5.000000 sec. You have 154 out of 4608729 that take longer than 5.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.1/en/point-in-time-recovery.html WORKER THREADS Current thread_cache_size = 256 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 = 30 Current threads_connected = 1 Historic max_used_connections = 31 The number of used connections is 103% of the configured maximum. You should raise max_connections No InnoDB Support Enabled! MEMORY USAGE Max Memory Ever Allocated : 2.26 G Configured Max Per-thread Buffers : 2.14 G Configured Max Global Buffers : 51 M Configured Max Memory Limit : 2.19 G Physical Memory : 1.00 G Max memory limit exceeds 90% of physical memory KEY BUFFER Current MyISAM index space = 16 M Current key_buffer_size = 16 M Key cache miss rate is 1 : 150115 Key buffer free ratio = 10 % You could increase key_buffer_size It is safe to raise this up to 1/4 of total system memory; assuming this is a dedicated database server. QUERY CACHE Query cache is enabled Current query_cache_size = 35 M Current query_cache_used = 7 M Current query_cache_limit = 8 M Current Query cache Memory fill ratio = 20.83 % 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 = 64 M Current read_rnd_buffer_size = 768 K Sort buffer seems to be fine JOINS Current join_buffer_size = 260.00 K You have had 6231 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 = 5000 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 = 2000 tables Current table_definition_cache = 256 tables You have a total of 146 tables You have 279 open tables. The table_cache value seems to be fine TEMP TABLES Current max_heap_table_size = 50 M Current tmp_table_size = 190 M Of 325898 temp tables, 30% 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 = 8 M Current table scan ratio = 1134 : 1 read_buffer_size seems to be fine TABLE LOCKING Current Lock Wait ratio = 1 : 1853 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'. Udostępnij ten post Link to postu Udostępnij na innych stronach
LANcaster (kotkowicz.pl) 52 Zgłoś post Napisano Wrzesień 10, 2013 (edytowany) Witam, planowałem optymalizacje serwera baz danych od dłuższego czasu programem tuning-primer. Uptime serwera trwa ponad 14 dni, więc wyniki raczej powinny być rzetelne. Jednak nie chciałbym popełnić żadnej gafy przy zmianie wartości oraz przy ewentualnych innych rzeczach co radzi program, więc proszę o "rozszyfrowanie" co program przekazuje i zaproponowanie optymalnych wartości. [ciach] A ile masz RAMu? :-) Edytowano Wrzesień 10, 2013 przez LANcaster (kotkowicz.pl) (zobacz historię edycji) Udostępnij ten post Link to postu Udostępnij na innych stronach
Gość patrys Zgłoś post Napisano Wrzesień 10, 2013 Lepszym wyborem narzędzia będzie mysqltuner.pl Udostępnij ten post Link to postu Udostępnij na innych stronach
Delmus 0 Zgłoś post Napisano Wrzesień 10, 2013 1GB RAM, 2GHz procesor Co do mysqltuner, nie wiem czy dobrze zrobiłem, ale wziąłem kod ze strony, zapisałem jako plik na serwerze i chciałem uruchomić poleceniem bash i nie poszło: root@ded8:~# bash mysqltuner mysqltuner: line 37: use: command not found mysqltuner: line 38: use: command not found mysqltuner: line 39: use: command not found mysqltuner: line 40: use: command not found mysqltuner: line 41: use: command not found mysqltuner: line 44: my: command not found mysqltuner: line 45: syntax error near unexpected token `@adjvars,' mysqltuner: line 45: `my (@adjvars, @generalrec);' Udostępnij ten post Link to postu Udostępnij na innych stronach
kovalsky 22 Zgłoś post Napisano Wrzesień 10, 2013 (edytowany) Pobieranie mysqltunera: wget https://raw.github.com/major/MySQLTuner-perl/master/mysqltuner.pl Dodanie uprawnienia do wykonania dla aktualnego usera: chmod u+x mysqltuner.pl Uruchomienie mysqltunera: ./mysqltuner.pl [EDIT] Shebang: #!/usr/bin/perl -w to skrypt perlowy. Edytowano Wrzesień 10, 2013 przez kovalsky (zobacz historię edycji) Udostępnij ten post Link to postu Udostępnij na innych stronach
Delmus 0 Zgłoś post Napisano Wrzesień 10, 2013 Nie zrozumiałem co napisałeś do mnie w edit'cie, a oto co mysqltuner wykazał. root@ded8:~# ./mysqltuner.pl >> 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 [OK] Logged in using credentials from debian maintenance account. -------- General Statistics -------------------------------------------------- [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 5.1.66-0+squeeze1-log [OK] Operating on 32-bit architecture with less than 2GB RAM -------- Storage Engine Statistics ------------------------------------------- [--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster [--] Data in MyISAM tables: 62M (Tables: 123) [!!] Total fragmented tables: 9 -------- Security Recommendations ------------------------------------------- [OK] All database users have passwords assigned -------- Performance Metrics ------------------------------------------------- [--] Up for: 14d 8h 54m 9s (4M q [3.782 qps], 423K conn, TX: 18B, RX: 1B) [--] Reads / Writes: 64% / 36% [--] Total buffers: 101.0M global + 73.2M per thread (30 max threads) [!!] Allocating > 2GB RAM on 32-bit systems can cause system instability [!!] Maximum possible memory usage: 2.2G (224% of installed RAM) [OK] Slow queries: 0% (158/4M) [!!] Highest connection usage: 100% (31/30) [OK] Key buffer size / total MyISAM indexes: 16.0M/16.4M [OK] Key buffer hit rate: 100.0% (1B cached / 11K reads) [OK] Query cache efficiency: 53.7% (1M cached / 2M selects) [!!] Query cache prunes per day: 1815 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 550K sorts) [!!] Joins performed without indexes: 6282 [!!] Temporary tables created on disk: 30% (147K on disk / 479K total) [OK] Thread cache hit rate: 99% (31 created / 423K connections) [OK] Table cache hit rate: 27% (279 open / 1K opened) [OK] Open file limit used: 8% (425/5K) [OK] Table locks acquired immediately: 99% (4M immediate / 4M locks) -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Reduce or eliminate persistent connections to reduce connection usage 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 Variables to adjust: *** MySQL's maximum memory usage is dangerously high *** *** Add RAM before increasing MySQL buffer variables *** max_connections (> 30) wait_timeout (< 28800) interactive_timeout (< 28800) query_cache_size (> 35M) join_buffer_size (> 256.0K, or always use indexes with joins) tmp_table_size (> 190M) max_heap_table_size (> 50M) Udostępnij ten post Link to postu Udostępnij na innych stronach
maniektme 99 Zgłoś post Napisano Wrzesień 11, 2013 [!!] Maximum possible memory usage: 2.2G (224% of installed RAM) A napisałeś, że masz 1 GB RAM - chyba już na pierwszy rzut oka coś tutaj nie pasuje? W pliku my.cnf masz wiele magicznych cyferek, które przemnożone przez siebie mogą Ci dać obraz jakie będziesz mieć zużycie zasobów swojej maszyny, gdy będziesz miał X połączeń mysql. Joins performed without indexes: 6282 Indeksy, indeksy i jeszcze raz indeksy - zapoznaj się z czym to się je. Udostępnij ten post Link to postu Udostępnij na innych stronach