• 技术文章 >数据库 >mysql教程

    Semi-Sync replication performance in MySQL 5.7.4 DMR_MySQL

    2016-06-01 13:12:56原创450
    I was interested to hear about semi-sync replication improvements in MySQL’s 5.7.4 DMR release and decided to check it out. I previouslyblogged about poor semi-sync performanceand was pretty disappointed from semi-sync’s performance across WAN distances back then, particularly with many client threads.

    The Test

    The basic environment of these tests was:

    Without further ado, here’s the TpmC results I got for a single client thread:

    These graphs are interactive, so mouse-over for more details. I’m using log scales to better highlight the differences.

    The blue bars represent transactions per second (more is better). The red bars represent average latency per transaction per client (less is better). Remember these transactions are synchronously being copied across the US before the client can execute another.

    The first test is our control: Async allows ~273 TPS on a single thread. Once we introduce synchronicity, we clearly see the bulk of the time is that round trip. Note that MySQL 5.5 and 5.6 are a bit higher than MySQL 5.7 and Percona XtraDB Cluster, the latter of which show pretty similar results.

    Adding parallelism

    This gets more interesting to see if we redo the same tests, but with 32 test threads:

    In the MySQL 5.5 and 5.6 tests, we can clearly see nasty serialization. Both really don’t allow more performance than single threaded sysbench. I was happy to see, however, that this seems to be dramatically improved in MySQL 5.7, nice job Oracle!

    AFTER_SYNC and AFTER_COMMIT vary, but AFTER_SYNC is the default and is preferred over AFTER_COMMIT. The reasoning here is AFTER_SYNC forces the semi-sync wait BEFORE the transaction is committed on the master. The client still must wait for the semi-sync in AFTER_COMMIT, but other transactions may see its data on the master BEFORE we confirm the semi-sync slave has received it. This is potentially bad because if the master crashed at that instant, clients may have read data from the master that did not make it to a failover slave. This is a type of ‘phantom read’ andYoshinori explains it in more detail here.

    What about Percona XtraDB Cluster?

    I also want to discuss the Percona XtraDB Cluster results, Galera here is somewhat slower than MySQL 5.7 semi-sync. There may be some enhancements to Galera that can be made (competition is a good thing), but there are still some significant differences here:

    TL;DR

    Semi-sync in MySQL 5.7 looks like a great improvement. Any form of synchronicity is always going to be expensive, particularly over 10s and 100s of milliseconds of latency. With MySQL 5.7, I’d be much more apt to recommend semi-sync as an option than in previous releases. Thanks to Oracle for investing here.

    声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。
    专题推荐:
    上一篇:MYSQL 分表原理(转) 下一篇:MySQL数据迁移到MSSQL-以小米数据库为例-测试828W最快可达到2分1_MySQL

    相关文章推荐

    • 必须要了解MySQL索引的坑• mysql中怎么调用存储过程• MySQL之SQL优化、索引优化、锁机制、主从复制(图文详解)• mysql怎样增加表格• mysql怎样查询最新的一条记录

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网