C
C
cru5ader2020-07-27 08:26:18
MySQL
cru5ader, 2020-07-27 08:26:18

How to optimize MySql for Bitrix?

Good afternoon, please help with MySQl optimization for Bitrix:

spoiler
>>  MySQLTuner 1.7.19 - Major Hayden <[email protected]>
 >>  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 5.7.24-log
[OK] Operating on 64-bit architecture
 
-------- Log file Recommendations ------------------------------------------------------------------
[OK] Log file /var/log/mysql.log exists
[--] Log file: /var/log/mysql.log(0B)
[OK] Log file /var/log/mysql.log is readable.
[!!] Log file /var/log/mysql.log is empty
[OK] Log file /var/log/mysql.log is smaller than 32 Mb
[OK] /var/log/mysql.log doesn't contain any warning.
[OK] /var/log/mysql.log doesn't contain any error.
[--] 0 start(s) detected in /var/log/mysql.log
[--] 0 shutdown(s) detected in /var/log/mysql.log
 
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA 
[--] Data in InnoDB tables: 13.6G (Tables: 632)
[!!] Total fragmented tables: 1
 
-------- 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 20h 51m 54s (82M q [508.377 qps], 1M conn, TX: 274G, RX: 81G)
[--] Reads / Writes: 98% / 2%
[--] Binary logging is enabled (GTID MODE: OFF)
[--] Physical Memory     : 11.5G
[--] Max MySQL memory    : 19.8G
[--] Other process memory: 0B
[--] Total buffers: 7.8G global + 164.2M per thread (75 max threads)
[--] P_S Max memory usage: 72B
[--] Galera GCache Max memory usage: 0B
[!!] Maximum reached memory usage: 11.2G (96.68% of installed RAM)
[!!] Maximum possible memory usage: 19.8G (171.74% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
[OK] Slow queries: 0% (4/82M)
[OK] Highest usage of available connections: 28% (21/75)
[OK] Aborted connections: 0.00%  (2/1050481)
[!!] 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.
[!!] Query cache efficiency: 0.0% (0 cached / 77M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (4K temp sorts / 32M sorts)
[!!] Joins performed without indexes: 13544504
[!!] Temporary tables created on disk: 91% (31M on disk / 34M total)
[OK] Thread cache hit rate: 99% (21 created / 1M connections)
[!!] Table cache hit rate: 4% (2K open / 42K opened)
[OK] table_definition_cache(1424) is upper than number of tables(911)
[OK] Open file limit used: 0% (4/5K)
[OK] Table locks acquired immediately: 100% (36K immediate / 36K locks)
[OK] Binlog cache memory access: 100.00% (835430 Memory / 835441 Total)
 
-------- Performance schema ------------------------------------------------------------------------
[--] Memory used by P_S: 72B
[--] Sys schema is installed.
 
-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.
 
-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.2% (1M used / 8M cache)
[OK] Key buffer size / total MyISAM indexes: 8.0M/43.0K
 
-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 6.5G/13.6G
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (30.7692307692308 %): 1.0G * 2/6.5G should be equal to 25%
[!!] InnoDB buffer pool instances: 4
[--] Number of InnoDB Buffer Pool Chunk : 52 for 4 Buffer Pool Instance(s)
[OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
[OK] InnoDB Read buffer efficiency: 100.00% (18955451046 hits/ 18955619999 total)
[!!] InnoDB Write Log efficiency: 18.55% (209625 hits/ 1130342 total)
[OK] InnoDB log waits: 0.00% (0 waits / 920717 writes)
 
-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.
 
-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.
 
-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.
 
-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.
 
-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] This server is acting as master for 1 server(s).
[--] Binlog format: MIXED
[--] XA support enabled: ON
[--] Semi synchronous replication Master: Not Activated
[--] Semi synchronous replication Slave: Not Activated
[--] No replication setup for this server or replication not started.
 
-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
    Reduce your overall MySQL memory footprint for system stability
    Dedicate this server to your database for highest performance.
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    We will suggest raising the 'join_buffer_size' until JOINs not using indexes are found.
             See https://dev.mysql.com/doc/internals/en/join-buffer-size.html
             (specially the conclusions at the bottom of the page).
    Temporary table size is already large - reduce result set size
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: https://bit.ly/2Fulv7r
    Read this before increasing for MariaDB https://mariadb.com/kb/en/library/optimizing-table_open_cache/
    This is MyISAM only table_cache scalability problem, InnoDB not affected.
    See more details here: https://bugs.mysql.com/bug.php?id=49177
    This bug already fixed in MySQL 5.7.9 and newer MySQL versions.
    Beware that open_files_limit (5000) variable 
    should be greater than table_open_cache (2048)
    Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    join_buffer_size (> 16.0M, or always use indexes with JOINs)
    table_open_cache (> 2048)
    innodb_buffer_pool_size (>= 13.6G) if possible.
    innodb_log_file_size should be (=832M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
    innodb_buffer_pool_instances(=6)


I understand correctly that it is worth increasing the RAM to 25 gigabytes, and what even more critical points should be tuned, is MySQl configured in replication (master-slave)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2020-07-27
@cru5ader

Show the site, preferably a screenshot with a debugging checkbox and the number of cached requests on the catalog page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question