Проблема с MySQL

1 234
Продюсер
На сайте с 09.11.2010
Offline
36
#21

Эти строчки добавить в my.сnf ?

Сделал...через час вывод покажу.

---------- Добавлено 21.01.2013 в 21:51 ----------

Спустя час:

[root@92 ~]# ./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
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.28
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 362M (Tables: 1063)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 1M (Tables: 8)
[!!] Total fragmented tables: 10

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1h 4m 31s (20K q [5.200 qps], 1K conn, TX: 542M, RX: 4M)
[--] Reads / Writes: 76% / 24%
[--] Total buffers: 96.0M global + 2.5M per thread (40 max threads)
[OK] Maximum possible memory usage: 196.0M (38% of installed RAM)
[OK] Slow queries: 0% (0/20K)
[OK] Highest usage of available connections: 10% (4/40)
[OK] Key buffer size / total MyISAM indexes: 32.0M/131.5M
[OK] Key buffer hit rate: 97.7% (259K cached / 6K reads)
[OK] Query cache efficiency: 53.1% (6K cached / 13K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts)
[OK] Temporary tables created on disk: 18% (33 on disk / 181 total)
[OK] Thread cache hit rate: 99% (4 created / 1K connections)
[OK] Table cache hit rate: 93% (544 open / 583 opened)
[OK] Open file limit used: 24% (1K/4K)
[OK] Table locks acquired immediately: 99% (12K immediate / 12K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
A
На сайте с 19.07.2010
Offline
130
#22

уже значительно лучше, давайте подождем до утра - пусть соберется статистика.

.............
MT
На сайте с 15.01.2013
Offline
49
#23

1 часа всегда мало, ребят.

Вообще статистика и вывод mysqltuner'a адекватный - это полный цикл дня (24 часа). Ибо если запускать это под ночь, то статистика будет кривая и днем вылезут косяки.

marcus@cluster:~$
Продюсер
На сайте с 09.11.2010
Offline
36
#24

Вот утренние анализы:

[root@92 ~]# ./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
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.28
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 362M (Tables: 1063)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 1M (Tables: 8)
[!!] Total fragmented tables: 29

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 10h 22m 20s (204K q [5.466 qps], 17K conn, TX: 5B, RX: 45M)
[--] Reads / Writes: 75% / 25%
[--] Total buffers: 96.0M global + 2.5M per thread (40 max threads)
[OK] Maximum possible memory usage: 196.0M (38% of installed RAM)
[OK] Slow queries: 0% (0/204K)
[OK] Highest usage of available connections: 22% (9/40)
[OK] Key buffer size / total MyISAM indexes: 32.0M/131.7M
[OK] Key buffer hit rate: 99.5% (2M cached / 12K reads)
[OK] Query cache efficiency: 54.9% (71K cached / 130K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 15K sorts)
[OK] Temporary tables created on disk: 12% (156 on disk / 1K total)
[OK] Thread cache hit rate: 99% (9 created / 17K connections)
[OK] Table cache hit rate: 82% (1K open / 1K opened)
[OK] Open file limit used: 52% (2K/4K)
[OK] Table locks acquired immediately: 99% (127K immediate / 127K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries

[root@92 ~]#
A
На сайте с 19.07.2010
Offline
130
#25

полет нормальный, посмотрим как он дневную нагрузку перенесет.

Продюсер
На сайте с 09.11.2010
Offline
36
#26

Вечер, вот так:

[root@92 ~]# ./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
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.28
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 363M (Tables: 1063)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 1M (Tables: 8)
[!!] Total fragmented tables: 32

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 22h 31m 46s (565K q [6.971 qps], 45K conn, TX: 15B, RX: 134M)
[--] Reads / Writes: 75% / 25%
[--] Total buffers: 96.0M global + 2.5M per thread (40 max threads)
[OK] Maximum possible memory usage: 196.0M (38% of installed RAM)
[OK] Slow queries: 0% (1/565K)
[OK] Highest usage of available connections: 22% (9/40)
[OK] Key buffer size / total MyISAM indexes: 32.0M/132.0M
[OK] Key buffer hit rate: 99.7% (6M cached / 17K reads)
[OK] Query cache efficiency: 55.5% (203K cached / 366K selects)
[!!] Query cache prunes per day: 17436
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 47K sorts)
[OK] Temporary tables created on disk: 15% (764 on disk / 4K total)
[OK] Thread cache hit rate: 99% (9 created / 45K connections)
[OK] Table cache hit rate: 64% (1K open / 1K opened)
[OK] Open file limit used: 53% (2K/4K)
[OK] Table locks acquired immediately: 99% (381K immediate / 381K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Variables to adjust:
query_cache_size (> 48M)

[root@92 ~]#
A
На сайте с 19.07.2010
Offline
130
#27

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


max_connections = 30
query_cache_size = 72M
Продюсер
На сайте с 09.11.2010
Offline
36
#28

Спасибо за подробную помощь, сделал.

doctorpc
На сайте с 12.07.2009
Offline
112
#29

В свое время очень помог небольшой скрипт на python, который показывает расход памяти разными службами.

Может случиться, что другая служба использует всю оперативную память в том числе те 196.0Mb, которые у Вас сейчас отданы Mysql.

Скрипт прикреплен. Требует установленный python на сервере.

apt-get install python

Дальше скрипт должен быть исполняемым и запускается командой

python ps_mem.py

Также полезным для анализа используемой памяти может быть команда

free -m

[ATTACH]118944[/ATTACH]

zip ps_mem.zip
Продюсер
На сайте с 09.11.2010
Offline
36
#30

Еще спустя сутки:


[root@92 ~]# ./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
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.28
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 364M (Tables: 1063)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 1009K (Tables: 8)
[!!] Total fragmented tables: 33

-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 20h 35m 5s (674K q [9.103 qps], 53K conn, TX: 18B, RX: 164M)
[--] Reads / Writes: 75% / 25%
[--] Total buffers: 120.0M global + 2.5M per thread (30 max threads)
[OK] Maximum possible memory usage: 195.0M (38% of installed RAM)
[OK] Slow queries: 0% (0/674K)
[OK] Highest usage of available connections: 46% (14/30)
[OK] Key buffer size / total MyISAM indexes: 32.0M/133.0M
[OK] Key buffer hit rate: 99.7% (8M cached / 22K reads)
[OK] Query cache efficiency: 57.2% (257K cached / 450K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (2 temp sorts / 67K sorts)
[OK] Temporary tables created on disk: 25% (1K on disk / 6K total)
[OK] Thread cache hit rate: 99% (33 created / 53K connections)
[OK] Table cache hit rate: 51% (586 open / 1K opened)
[OK] Open file limit used: 25% (1K/4K)
[OK] Table locks acquired immediately: 99% (475K immediate / 475K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
1 234

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