Как ускорить большую базу?

123
Оптимизайка
На сайте с 11.03.2012
Offline
396
#11

Для начала запросы покажите которые этот phpmyadmin генерирует при этих "тормозных" операциях. План и время их выполнения тоже.

⭐ BotGuard (https://botguard.net) ⭐ — защита вашего сайта от вредоносных ботов, воровства контента, клонирования, спама и хакерских атак!
G-and-Y
На сайте с 29.06.2013
Offline
156
#12

cat /etc/mysql/my.conf

mysqltuner

Покажите вывод этих команд.

Абузо-устойчивые впс в Нидерландах от 5$/мес (https://cp.inferno.name/aff.php?aff=2991)
Playray
На сайте с 06.09.2008
Offline
133
#13
G-and-Y:
cat /etc/mysql/my.conf
mysqltuner

Покажите вывод этих команд.

cat: /etc/mysql/my.conf: No such file or directory

[root@vmi129504 ~]# mysqltuner

Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: >> MySQLTuner 1.6.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
[--] Skipped version check for MySQLTuner script
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
[OK] Currently running supported MySQL version 5.7.19
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
[--] Data in InnoDB tables: 4G (Tables: 70)
[!!] Total fragmented tables: 10
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.

-------- Security Recommendations -------------------------------------------
mysql: [Warning] Using a password on the command line interface can be insecure.
[OK] There is no anonymous account in all database users
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1054 (42S22) at line 1: Unknown column 'password' in 'where clause'
[OK] All database users have passwords assigned
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1054 (42S22) at line 1: Unknown column 'password' in 'where clause'
mysql: [Warning] Using a password on the command line interface can be insecure.
[!!] There is not basic password file list !
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.

-------- Performance Metrics -------------------------------------------------
[--] Up for: 4d 0h 40m 18s (56M q [161.155 qps], 290K conn, TX: 184B, RX: 89B)
[--] Reads / Writes: 85% / 15%
[--] Binary logging is disabled
[--] Total buffers: 169.0M global + 1.1M per thread (151 max threads)
[OK] Maximum reached memory usage: 225.2M (0.45% of installed RAM)
[OK] Maximum possible memory usage: 338.9M (0.68% of installed RAM)
[OK] Slow queries: 0% (0/56M)
[OK] Highest usage of available connections: 33% (50/151)
[OK] Aborted connections: 0.00% (6/290758)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (7K temp sorts / 20M sorts)
[!!] Temporary tables created on disk: 66% (10M on disk / 15M total)
[OK] Thread cache hit rate: 99% (899 created / 290K connections)
[!!] Table cache hit rate: 0% (1K open / 341K opened)
[OK] Open file limit used: 0% (32/5K)
[OK] Table locks acquired immediately: 100% (253 immediate / 253 locks)

-------- MyISAM Metrics -----------------------------------------------------
[!!] Key buffer used: 18.3% (1M used / 8M cache)
[OK] Key buffer size / total MyISAM indexes: 8.0M/45.0K
[OK] Read Key buffer hit rate: 95.1% (204 cached / 10 reads)

-------- InnoDB Metrics -----------------------------------------------------
[--] InnoDB is enabled.
[!!] InnoDB buffer pool / data size: 128.0M/4.3G
[OK] InnoDB buffer pool instances: 1
[OK] InnoDB Used buffer: 92.52% (7578 used/ 8191 total)
[OK] InnoDB Read buffer efficiency: 99.82% (86355744286 hits/ 86509207456 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[OK] InnoDB log waits: 0.00% (0 waits / 7525601 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
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Increase table_open_cache gradually to avoid file descriptor limits
Read this before increasing table_open_cache over 64: http://*******/1mi7c4C
Beware that open_files_limit (5000) variable
should be greater than table_open_cache ( 2000)
Variables to adjust:
query_cache_type (=1)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
table_open_cache (> 2000)
innodb_buffer_pool_size (>= 4G) if possible.
G-and-Y
На сайте с 29.06.2013
Offline
156
#14

сори, так

cat /etc/mysql/my.cnf

---------- Добавлено 31.07.2017 в 04:39 ----------

Добавьте или измените в конфиге

Правим конфиг, если дебиан то он тут

nano /etc/mysql/my.cnf

innodb_buffer_pool_size = 5G
innodb_buffer_pool_instances = 5
innodb_additional_mem_pool_size = 16M
innodb_flush_method = O_DIRECT
innodb_flush_log_at_trx_commit = 0
innodb_log_buffer_size=16M
innodb_log_file_size = 256M
table_open_cache = 300000
tmp_table_size = 256M
max_heap_table_size = 256M
query-cache-size = 512M

Перезагружаем базу

/etc/init.d/mysql restart

Увеличиваем лимиты на открытие файлов

ulimit -u 555555

ulimit -n 555555

По идеи сайт взлетит, пробуйте!

Andreyka
На сайте с 19.02.2005
Offline
822
#15

Советую поставить еще один сервер и сделать реплику для чтения

Не стоит плодить сущности без необходимости
G-and-Y
На сайте с 29.06.2013
Offline
156
#16

Andreyka ляп абы не молча, тс написал что у него большая посещаемость?

N
На сайте с 06.05.2007
Offline
419
#17
adel92:
Я бы с Вами поспорил. Банально MySQL по умолчанию не знает сколько у Вас будет ОЗУ.
Как минимум только поэтому уже нужно править конфиги.

Зато ОС знает. И активно использует эту память в качестве кеша.

G-and-Y:
query-cache-size = 512M
По идеи сайт взлетит, пробуйте!

О, бомба заложена. "Оптимизация".

Кнопка вызова админа ()
lonelywoolf
На сайте с 23.12.2013
Offline
151
#18
G-and-Y:
query-cache-size = 512M

Больше 128M ставить практически не имеет смысла. Это лишь снизит производительность.

Платный и бесплатный хостинг с защитой от DDoS (http://aquinas.su)
baas
На сайте с 17.09.2012
Offline
162
#19
lonelywoolf:
Больше 128M ставить практически не имеет смысла. Это лишь снизит производительность.

Почему?

Если загнуть в кэш только тяжелые запросы?

Настройка BSD систем. (https://www.fryaha.ru) Знание сила, незнание Рабочая сила!
lonelywoolf
На сайте с 23.12.2013
Offline
151
#20
baas:
Если загнуть в кэш только тяжелые запросы?

Это как?

Почему? Потому, что время поиска в кэше становится намного больше, чем при других условиях.

123

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий