我最近將一個生產系統從單個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」還是所有查詢? –
就我所知,SELECT是問題。系統生成數據似乎沒有問題;這是報道,已經受到重創,成績顯着。 – koenig
你是CPU綁定還是磁盤綁定?這些機器與前一臺服務器相媲美嗎?特別是關於磁盤性能和內存,還有內核的類型和數量? 'innodb_buffer_pool_size'可比嗎? –