Недавно я переместил производственную систему с одного экземпляра MySQL на кластер Galera с тремя узлами. Кажется, все работает нормально, но для запросов SELECT; производительность запросов с момента переезда резко упала, и теперь она невыносима.
У кого-нибудь есть какие-нибудь советы по настройке производительности Galera? Я полный новичок в Galera, и настройка, которую я сделал, вероятно, самая простая из всех.
Это часть Galera файла my.cnf:
# Galera
wsrep_provider =/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address ="gcomm:// 213.179.3.90, 213.179.3.91, 213.179.3.92"
wsrep_sst_method =rsync
wsrep_cluster_name =galera_cluster
binlog_format =ROW
default_storage_engine =InnoDB
innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1
и вот один запрос, который занимает вечность:
SELECT
r.customerid,
r.operator,
r.account,
CAST(r.requesttype AS char),
CAST(SUM(r.nofsms) AS char),
COALESCE(r.subid1, ''),
COALESCE(r.subid2, ''),
COALESCE(r.subid3, '')
FROM
`smspro`.`smspro_cc_result` r
INNER JOIN smspro.smspro_customer sc ON sc.customerid = r.customerid
AND sc.smsproinvoice = 0
WHERE
r.status = 0
AND r.timestamp >= '2016-05-25'
AND r.timestamp < '2016-06-25'
AND r.requesttype IN (1 , 2, 4, 5)
GROUP BY r.customerid , r.operator , r.account , r.requesttype , r.subid1 , r.subid2 , r.subid3
ORDER BY r.customerid , r.operator , r.account , r.requesttype , r.subid1 , r.subid2 , r.subid3
И немного статистики
mysql> select count(*) from smspro_cc_result;
+----------+
| count(*) |
+----------+
| 9170870 |
+----------+
mysql> show index from smspro_cc_result;
+------------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| smspro_cc_result | 0 | PRIMARY | 1 | smsproid | A | 8825169 | NULL | NULL | | BTREE | | |
| smspro_cc_result | 1 | idx_sms_req_1 | 1 | customerid | A | 14757 | NULL | NULL | | BTREE | | |
| smspro_cc_result | 1 | idx_sms_req_2 | 1 | timestamp | A | 4412584 | NULL | NULL | | BTREE | | |
| smspro_cc_result | 1 | idx_sms_req_3 | 1 | customerid | A | 18233 | NULL | NULL | | BTREE | | |
| smspro_cc_result | 1 | idx_sms_req_3 | 2 | msisdn | A | 8825169 | NULL | NULL | | BTREE | | |
| smspro_cc_result | 1 | idx_sms_req_3 | 3 | timestamp | A | 8825169 | NULL | NULL | | BTREE | | |
| smspro_cc_result | 1 | idx_sms_req_5 | 1 | msisdn | A | 8825169 | NULL | NULL | | BTREE | | |
+------------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
Я что-то забыл или здесь весь справочный материал?
SELECT
или все запросы? - person Michael - sqlbot   schedule 23.08.2016innodb_buffer_pool_size
? - person Michael - sqlbot   schedule 26.08.2016