[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Конфигурация MySql
Serg86
В общем ситуация такова: Проект работал на хостинге bget, всё вроди ничего, но со временем пришел к тому что в конфиге MySql нужно увеличить innodb_buffer_pool_size. Они такой возможности не дают. Переехал на VDS.

Долгий и мучительный переезд был, но не суть. На bget проблема была в том что запросы вытесняли друг друга из буфера и складывалась такая картина, что при первом выполнении запроса он отрабатывал за 3-5 секунд, второй раз за 0,02 -0,04.

Переехал на новый хост, увеличил innodb_buffer_pool_size, те же самые запросы выполняются за 3-5 секунд. Такое ощущение что индексы вообще не используются, хотя судя по explain всё то же самое что и на старом хосте, индексы задействованы.

Вот конфиг MySql:

[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

[mysqld]
port = 3306
#bind-address = 127.0.0.1
socket = /var/run/mysqld/mysqld.sock
pid-file = /var/run/mysqld/mysqld.pid
datadir = /var/lib/mysql
tmpdir = /tmp
#userstat = 1
#default-storage-engine = MyISAM
default-storage-engine = InnoDB
innodb_large_prefix = 1
innodb_file_format = Barracuda
innodb_file_per_table = ON

log-error = /var/log/mysql/mysql-err.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/mysql-slow-queries.log
long_query_time = 4
log_slow_filter = filesort_on_disk,tmp_table_on_disk

skip-external-locking

#character_set_server = cp1251
#character_set_client = cp1251
#skip-character-set-client-handshake

character_set_server = utf8
#character_set_client = utf8mb4
#skip-character-set-client-handshake


###
innodb_buffer_pool_size = 2048M
innodb_buffer_pool_instances = 2
###

open_files_limit = 20480
max_connections = 100
max_allowed_packet = 16M
#max_allowed_packet=2048M
key_buffer_size = 350M
#table_cache = 64
thread_cache_size = 24
sort_buffer_size = 32M
query_cache_limit = 20M
query_cache_size = 32M

myisam_sort_buffer_size = 32M
myisam-recover-options = BACKUP


[mariadb]
#aria_pagearia_pagecache_buffer_size = 8m
#aria_sort_buffer_size = 1m
#skip-pbxt
#skip-blackhole
#skip-archive
#skip-federated

[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[isamchk]
key_buffer = 16M

Подскажите дилетанту что не так.

Да еще одна поправка:
На старом хосте был MySQL: 5.6.26
На ново MySQL: 10.1.10-MariaDB
Может здесь собака зарыта.
Serg86
Вот что получил в mysqltuner
root@vm-111111111:~# ./mysqltuner.pl
-bash: ./mysqltuner.pl: No such file or directory
root@vm-111111111:~# ./mysqltuner.pl
-bash: ./mysqltuner.pl: No such file or directory
root@vm-111111111:~# cd mysqltuner
root@vm-111111111:~/mysqltuner# mysqltuner.pl
-bash: mysqltuner.pl: command not found
root@vm-111111111:~/mysqltuner# ./mysqltuner.pl
[OK] Logged in using credentials from debian maintenance account.
>> MySQLTuner 1.6.2 - 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.10-MariaDB-1~wheezy-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Aria +CSV +InnoDB +MRG_MyISAM +SEQUENCE
[--] Data in MyISAM tables: 247M (Tables: 57)
[--] Data in InnoDB tables: 951M (Tables: 135)
[!!] Total fragmented tables: 15

-------- Security Recommendations -------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[--] There are 605 basic passwords in the list.

-------- CVE Security Recommendations -------------------------------------------
[--] Skipped due to --cvefile option undefined

-------- Performance Metrics -------------------------------------------------
[--] Up for: 8m 12s (3M q [6K qps], 334 conn, TX: 12B, RX: 278M)
[--] Reads / Writes: 99% / 1%
[--] Binary logging is disabled
[--] Total buffers: 2.5G global + 32.9M per thread (151 max threads)
[OK] Maximum reached memory usage: 3.1G (38.96% of installed RAM)
[!!] Maximum possible memory usage: 7.4G (92.40% of installed RAM)
[OK] Slow queries: 0% (75/3M)
[OK] Highest usage of available connections: 11% (18/151)
[OK] Aborted connections: 0.00% (0/334)
[OK] Query cache efficiency: 23.4% (1M cached / 4M selects)
[!!] Query cache prunes per day: 281592000
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 3K sorts)
[OK] Temporary tables created on disk: 2% (9 on disk / 409 total)
[OK] Thread cache hit rate: 94% (18 created / 334 connections)
[OK] Table cache hit rate: 105% (210 open / 199 opened)
[OK] Open file limit used: 0% (77/20K)
[OK] Table locks acquired immediately: 100% (3M immediate / 3M locks)

-------- MyISAM Metrics -----------------------------------------------------
[!!] Key buffer used: 19.5% (71M used / 367M cache)
[OK] Key buffer size / total MyISAM indexes: 350.0M/55.4M
[OK] Read Key buffer hit rate: 98.8% (181K cached / 2K reads)
[!!] Write Key buffer hit rate: 0.0% (1 cached / 1 writes)

-------- InnoDB Metrics -----------------------------------------------------
[--] InnoDB is enabled.
[OK] InnoDB buffer pool / data size: 2.0G/951.1M
[!!] InnoDB buffer pool instances: 1
[!!] InnoDB Used buffer: 22.34% (29285 used/ 131071 total)
[OK] InnoDB Read buffer efficiency: 99.99% (314885196 hits/ 314908885 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[OK] InnoDB log waits: 0.00% (0 waits / 915 writes)

-------- AriaDB Metrics -----------------------------------------------------
[--] AriaDB is disabled.

-------- Replication Metrics -------------------------------------------------
[--] No replication slave(s) for this server.
[--] This is a standalone server..

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Reduce your overall MySQL memory footprint for system stability
Variables to adjust:
*** MySQL's maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
query_cache_size (> 32M)
innodb_buffer_pool_instances(=2)
Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.