MySQL5.7 GR VS MariaDB10.1.19 Galera Cluster性能压测
视频演示:http://pan.baidu.com/s/1sk87tfB


工具sysbench0.5 128并发 10张表100万行

硬件配置R720 64G RAID10(SAS 15000转)

192.168.143.244 gr(primary-3306端口)     Galera(secondary-3308端口)
192.168.143.245 gr(secondary-3306端口)   Galera(primary-3308端口)
192.168.143.246 gr(secondary-3306端口)   Galera(secondary-3308端口)

我们这里纯粹是为了跑性能。

gr我关闭了限流group_replication_flow_control_mode = 'DISABLED'。因数据复制是通过binlog,这里我采用基于表的并行复制,slave_parallel_type = 'LOGICAL_CLOCK',开启并行复制线程slave_parallel_workers设置了24个线程。


Galera我将gcs.fc_limit设置了1000K,调整成最大,避免限流。开启并行复制线程wsrep_slave_threads设置了24个线程。

gr压测192.168.143.244,Galera压测192.168.143.245。BP都是30G

下面废话不多说,看视频演示,数据说话!

--------------------------------------------------------------------------------
GR
[  10s] threads: 128, tps: 768.46, reads: 10937.14, writes: 2339.68, response time: 335.94ms (95%), errors: 0.00, reconnects:  0.00
[  20s] threads: 128, tps: 1009.40, reads: 14132.12, writes: 3031.30, response time: 214.42ms (95%), errors: 0.00, reconnects:  0.00
[  30s] threads: 128, tps: 1060.00, reads: 14840.01, writes: 3179.30, response time: 195.94ms (95%), errors: 0.00, reconnects:  0.00
[  40s] threads: 128, tps: 1042.69, reads: 14597.30, writes: 3129.28, response time: 203.54ms (95%), errors: 0.00, reconnects:  0.00
[  50s] threads: 128, tps: 1083.11, reads: 15163.89, writes: 3249.42, response time: 189.03ms (95%), errors: 0.00, reconnects:  0.00
[  60s] threads: 128, tps: 979.30, reads: 13710.20, writes: 2938.00, response time: 210.79ms (95%), errors: 0.00, reconnects:  0.00
[  70s] threads: 128, tps: 974.39, reads: 13641.44, writes: 2922.97, response time: 199.02ms (95%), errors: 0.00, reconnects:  0.00
[  80s] threads: 128, tps: 762.01, reads: 10593.03, writes: 2267.93, response time: 360.43ms (95%), errors: 0.00, reconnects:  0.00
[  90s] threads: 128, tps: 960.30, reads: 13519.30, writes: 2897.30, response time: 286.83ms (95%), errors: 0.00, reconnects:  0.00
[ 100s] threads: 128, tps: 1015.30, reads: 14214.20, writes: 3046.30, response time: 188.41ms (95%), errors: 0.00, reconnects:  0.00


--------------------------------------------------------------------------------------
Galera
[  10s] threads: 128, tps: 1207.93, reads: 17081.43, writes: 3656.79, response time: 113.88ms (95%), errors: 0.00, reconnects:  0.00
[  20s] threads: 128, tps: 1302.00, reads: 18227.01, writes: 3904.70, response time: 112.76ms (95%), errors: 0.00, reconnects:  0.00
[  30s] threads: 128, tps: 1287.10, reads: 18021.19, writes: 3863.00, response time: 112.79ms (95%), errors: 0.00, reconnects:  0.00
[  40s] threads: 128, tps: 1279.60, reads: 17913.70, writes: 3839.20, response time: 114.97ms (95%), errors: 0.00, reconnects:  0.00
[  50s] threads: 128, tps: 1289.80, reads: 18058.41, writes: 3869.70, response time: 114.46ms (95%), errors: 0.00, reconnects:  0.00
[  60s] threads: 128, tps: 1275.20, reads: 17850.90, writes: 3824.90, response time: 116.12ms (95%), errors: 0.00, reconnects:  0.00
[  70s] threads: 128, tps: 1243.30, reads: 17406.47, writes: 3729.99, response time: 118.15ms (95%), errors: 0.00, reconnects:  0.00
[  80s] threads: 128, tps: 1287.20, reads: 18020.37, writes: 3861.19, response time: 114.08ms (95%), errors: 0.00, reconnects:  0.00
[  90s] threads: 128, tps: 1283.20, reads: 17967.07, writes: 3850.01, response time: 114.70ms (95%), errors: 0.00, reconnects:  0.00
[ 100s] threads: 128, tps: 1261.30, reads: 17656.79, writes: 3783.50, response time: 117.41ms (95%), errors: 0.00, reconnects:  0.00


总结

GR和Galera的性能不及半同步复制,如果您对性能要求较高,数据一致性不太在意,建议用MariaDB 10.1.X Loss-Less Semi  replication+MHA高可用架构。


关于GR和Galera,在部署生产环境中多做几次压测,选择一款适合您的。