|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
есть сервер с 200+ магазинами престашоп,базы innodb 24 ядра 64 гб озу предполагаю что в основном запросы на выборку товара как лучше настроить query_cache_size? везде пишут что его нужно отключить я для теста ставил 10-20% от озу и кеш всегда заполняется Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10.
Код: sql 1. 2.
Код: sql 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13.
LA очень низкое load average: 1.28, 1.09, 1.06 какие будут идеи? query_cache_size еще увеличить , уменьшить или совсем отключить? ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 07:03 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
запускал и что? он советует увеличить query_cache_size ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 12:12 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
tadeyiloda, Покажите его вывод полностью. Желательно в спойлере. ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 12:52 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
>> MySQLTuner 1.7.15 - Major Hayden <major@mhtx.net> >> Bug reports, feature requests, and downloads at http://mysqltuner.com/ >> Run with '--help' for additional options and output filtering [--] Skipped version check for MySQLTuner script [OK] Currently running supported MySQL version 10.1.40-MariaDB [OK] Operating on 64-bit architecture -------- Log file Recommendations ------------------------------------------------------------------ [--] Log file: /var/lib/mysql/localhost.localdomain.err(0B) [OK] Log file /var/lib/mysql/localhost.localdomain.err exists [OK] Log file /var/lib/mysql/localhost.localdomain.err is readable. [!!] Log file /var/lib/mysql/localhost.localdomain.err is empty [OK] Log file /var/lib/mysql/localhost.localdomain.err is smaller than 32 Mb [OK] /var/lib/mysql/localhost.localdomain.err doesn't contain any warning. [OK] /var/lib/mysql/localhost.localdomain.err doesn't contain any error. [--] 0 start(s) detected in /var/lib/mysql/localhost.localdomain.err [--] 0 shutdown(s) detected in /var/lib/mysql/localhost.localdomain.err -------- Storage Engine Statistics ----------------------------------------------------------------- [--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE [--] Data in MyISAM tables: 29.6M (Tables: 1662) [--] Data in InnoDB tables: 20.6G (Tables: 72661) [OK] Total fragmented tables: 0 -------- Analysis Performance Metrics -------------------------------------------------------------- [--] innodb_stats_on_metadata: OFF [OK] No stat updates during querying INFORMATION_SCHEMA. -------- Security Recommendations ------------------------------------------------------------------ [OK] There are no anonymous accounts for any database users [OK] All database users have passwords assigned [!!] There is no basic password file list! -------- CVE Security Recommendations -------------------------------------------------------------- [--] Skipped due to --cvefile option undefined -------- Performance Metrics ----------------------------------------------------------------------- [--] Up for: 1d 2h 34m 30s (176M q [1K qps], 398K conn, TX: 374G, RX: 35G) [--] Reads / Writes: 99% / 1% [--] Binary logging is disabled [--] Physical Memory : 62.9G [--] Max MySQL memory : 51.5G [--] Other process memory: 0B [--] Total buffers: 51.2G global + 3.7M per thread (100 max threads) [--] P_S Max memory usage: 0B [--] Galera GCache Max memory usage: 0B [OK] Maximum reached memory usage: 51.3G (81.53% of installed RAM) [OK] Maximum possible memory usage: 51.5G (81.93% of installed RAM) [OK] Overall possible memory usage with other process is compatible with memory available [OK] Slow queries: 0% (2/176M) [OK] Highest usage of available connections: 30% (30/100) [OK] Aborted connections: 0.00% (7/398329) [!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance [!!] Query cache may be disabled by default due to mutex contention. [OK] Query cache efficiency: 48.2% (161M cached / 334M selects) [!!] Query cache prunes per day: 5643774 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 2M sorts) [!!] Joins performed without indexes: 14684 [!!] Temporary tables created on disk: 32% (442K on disk / 1M total) [OK] Thread cache hit rate: 99% (30 created / 398K connections) [OK] Table cache hit rate: 71% (147K open / 204K opened) [OK] Open file limit used: 1% (5K/450K) [OK] Table locks acquired immediately: 99% (27M immediate / 27M locks) -------- Performance schema ------------------------------------------------------------------------ [--] Performance schema is disabled. [--] Memory used by P_S: 0B [--] Sys schema isn't installed. -------- ThreadPool Metrics ------------------------------------------------------------------------ [--] ThreadPool stat is enabled. [--] Thread Pool Size: 24 thread(s). [--] Using default value is good enough for your version (10.1.40-MariaDB) -------- MyISAM Metrics ---------------------------------------------------------------------------- [!!] Key buffer used: 20.1% (2M used / 10M cache) [OK] Key buffer size / total MyISAM indexes: 10.0M/10.5M [OK] Read Key buffer hit rate: 97.8% (4K cached / 100 reads) [OK] Write Key buffer hit rate: 100.0% (10 cached / 10 writes) -------- InnoDB Metrics ---------------------------------------------------------------------------- [--] InnoDB is enabled. [--] InnoDB Thread Concurrency: 0 [OK] InnoDB File per table is activated [OK] InnoDB buffer pool / data size: 40.0G/20.6G [OK] Ratio InnoDB log file size / InnoDB Buffer pool size: 5.0G * 2/40.0G should be equal to 25% [OK] InnoDB buffer pool instances: 40 [--] InnoDB Buffer Pool Chunk Size not used or defined in your version [OK] InnoDB Read buffer efficiency: 99.98% (4057651921 hits/ 4058639907 total) [!!] InnoDB Write Log efficiency: 28.23% (224212 hits/ 794242 total) [OK] InnoDB log waits: 0.00% (0 waits / 1018454 writes) -------- AriaDB Metrics ---------------------------------------------------------------------------- [--] AriaDB is enabled. [OK] Aria pagecache size / total Aria indexes: 128.0M/1B [OK] Aria pagecache hit rate: 98.6% (20M cached / 273K reads) -------- TokuDB Metrics ---------------------------------------------------------------------------- [--] TokuDB is disabled. -------- XtraDB Metrics ---------------------------------------------------------------------------- [--] XtraDB is disabled. -------- Galera Metrics ---------------------------------------------------------------------------- [--] Galera is disabled. -------- Replication Metrics ----------------------------------------------------------------------- [--] Galera Synchronous replication: NO [--] No replication slave(s) for this server. [--] Binlog format: STATEMENT [--] XA support enabled: ON [--] Semi synchronous replication Master: Not Activated [--] Semi synchronous replication Slave: Not Activated [--] This is a standalone server -------- Recommendations --------------------------------------------------------------------------- General recommendations: Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1 Increasing the query_cache size over 128M may reduce performance 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 Performance schema should be activated for better diagnostics Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL Consider installing Sys schema from https://github.com/good-dba/mariadb-sys for MariaDB Variables to adjust: query_cache_size (=0) query_cache_type (=0) query_cache_size (> 10G) [see warning above] join_buffer_size (> 1.0M, or always use indexes with JOINs) performance_schema = ON enable PFS ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 13:23 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
https://ruhighload.com/query_cache_size параметр в mysql вот тут пишут что надо вобще отключить query_cache_size ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 13:55 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
автор[!!] Joins performed without indexes: 14684 [!!] Temporary tables created on disk: 32% (442K on disk / 1M total) ну кроме этого вроде все норм. а какую проблему решаем то? ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 16:10 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
проблема такая- везде пишут что query_cache_size надо отключить, он только тормозит работу я пытаюсь понять нужно ли в моем случае использовать query_cache_size и если использовать то какой задать оптимальный размер ... |
|||
:
Нравится:
Не нравится:
|
|||
30.05.2019, 16:22 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
tadeyilodaвезде пишут что query_cache_size надо отключитьЕсли InnoDB buffer pool хватает (а его хватает), то в этом утверждении есть немалая доля здравого смысла. Большой query_cache_size плох тем, что при каждой модификации данных надо перебирать все запросы, чьи результаты там хранятся, и инвалидировать те из них, которые затрагиваются этой модификацией. В MySQL это довольно дорогая операция. Поэтому в базах, где много модификаций данных, действительно, имеет смысл отключать кэш запросов. И, признаться, я впервые вижу настолько большой кэш запросов. Обычно это 128-256 МБайт. Попробуйте уменьшать его в 2 раза за шаг и после каждого изменения не меньше суток следить за эффективностью кэша. ... |
|||
:
Нравится:
Не нравится:
|
|||
31.05.2019, 23:19 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
эффективность по каким критериям? сделал кеш 128мб и ЛА сразу вырос в несколько раз ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 12:19 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
tadeyiloda, ЛА вырос в первую очередь из-за рестарта MySQL, у него же все кэши сбросились, в т.ч. InnoDB buffer pool. Я поэтому и говорю, что смотреть надо в течение суток, чтобы кэши наполнились и разные профили нагрузки прошли (например, если они отличаются ночью и днем). Следить можно как по общесистемным параметрам, типа того же ЛА или среднего времени построения страницы, так и по этим: [OK] Query cache efficiency: 48.2% (161M cached / 334M selects) [!!] Query cache prunes per day: 5643774 Кстати, каково соотношение чтения к записи в целом по базе если считать в запросах? Я бы еще вот про это подумал: [!!] Temporary tables created on disk: 32% (442K on disk / 1M total) Не стоит ли временные файлы перенести на RAM-диск? Если физический диск HDD, то это даст ускорение. Если физический диск SSD, то это даст небольшую экономию его ресурса и небольшое ускорение. ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 14:50 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
[OK] Query cache efficiency: 30.2% (29M cached / 97M selects) [!!] Query cache prunes per day: 111220973 это query_cache_size=128M насчет ram диска хорошая идея, какой размер лучше выделить? с учетом max_heap_table_size = 2.00 G tmp_table_size = 2.00 G ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 21:08 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
tadeyilodaнасчет ram диска хорошая идея, какой размер лучше выделить? с учетом max_heap_table_size = 2.00 G tmp_table_size = 2.00 GИсходя из этих параметров нельзя сказать. Да и вообще сильно зависит от фактических запросов. Попробуйте последить за tmp-каталогом, куда MySQL временные файлы складывает. ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 22:15 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
счас почти у всех систем есть раздел tmpfs /dev/shm c размером 50% озу указал его в качестве tmpdir ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 22:40 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
tadeyilodac размером 50% озуУточните это для своего случая. Если это так, то оперативки может не хватить. ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 22:43 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
df -h Filesystem Size Used Avail Use% Mounted on /dev/md2 227G 145G 71G 68% / tmpfs 32G 0 32G 0% /dev/shm /dev/md0 488M 108M 355M 24% /boot ... |
|||
:
Нравится:
Не нравится:
|
|||
01.06.2019, 22:52 |
|
query_cache_size оптимизация
|
|||
---|---|---|---|
#18+
https://haydenjames.io/mysql-query-cache-size-performance/ тут тоже пишут что query_cache_size надо делать маленьким или совсем выключить ... |
|||
:
Нравится:
Не нравится:
|
|||
03.06.2019, 07:37 |
|
|
start [/forum/topic.php?fid=47&fpage=35&tid=1829119]: |
0ms |
get settings: |
9ms |
get forum list: |
13ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
39ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
66ms |
get tp. blocked users: |
2ms |
others: | 12ms |
total: | 160ms |
0 / 0 |