最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

Mydumper[less]locking_MySQL

来源:动视网 责编:小采 时间:2020-11-09 19:59:38
文档

Mydumper[less]locking_MySQL

Mydumper[less]locking_MySQL:07.01.2014|10 views|Related MicroZone ResourcesAppOps: Power to the Devs!FREE Top 10 Java Performance Problems EBookUshering in a New Era of APM for the EnterprisePerformance in the Enterprise: A Survival Guide4 Success stories of APM for
推荐度:
导读Mydumper[less]locking_MySQL:07.01.2014|10 views|Related MicroZone ResourcesAppOps: Power to the Devs!FREE Top 10 Java Performance Problems EBookUshering in a New Era of APM for the EnterprisePerformance in the Enterprise: A Survival Guide4 Success stories of APM for


07.01.2014|10 views|

Related MicroZone Resources

"AppOps": Power to the Devs!

FREE Top 10 Java Performance Problems EBook

Ushering in a New Era of APM for the Enterprise

Performance in the Enterprise: A Survival Guide

4 Success stories of APM for E-commerce

Like this piece? Share it with your friends:

|More

In this post I would like to review how my dumper for MySQL works from the point of view of locks. Since 0.6 serie we have different options, so I will try to explain how they work

As you may know mydumper is multithreaded and this adds a lot of complexity compared with other logical backup tools as it also needs to coordinate all threads with the same snapshot to be consistent. So let review how mydumper does this with the default settings.

By default mydumper uses 4 threads to dump data and 1 main thread

Main Thread

  • FLUSH TABLES WITH READ LOCK
  • Dump Thread X

  • START TRANSACTION WITH CONSISTENT SNAPSHOT;
  • dump non-InnoDB tables
  • Main Thread

  • UNLOCK TABLES
  • Dump Thread X

  • dump InnoDB tables
  • As you can see in this case we need FTWRL for two things, coordinate transaction’s snapshots and dump non-InnoDB tables in a consistent way. So we have have global read lock until we dumped all non-InnoDB tables.What less locking does is this:Main Thread

  • FLUSH TABLES WITH READ LOCK
  • Dump Thread X

  • START TRANSACTION WITH CONSISTENT SNAPSHOT;
  • LL Dump Thread X

  • LOCK TABLES non-InnoDB
  • Main Thread

  • UNLOCK TABLES
  • LL Dump Thread X

  • dump non-InnoDB tables
  • UNLOCK non-InnoDB
  • Dump Thread X

  • dump InnoDB tables
  • So now the global read lock its in place until less-locking threads lock non-InnoDB tables, and this is really fast. The only downsize is that it uses double the amount of threads, so for the default (4 threads) we will end up having 9 connections, but always 4 will be running at the same time.

    Less-locking really helps when you have MyISAM or ARCHIVE that are not heavily updated by production workload, also you should know that LOCK TABLE … READ LOCAL allows non conflicting INSERTS on MyISAM so if you use that tables to keep logs (append only) you will not notice that lock at all.

    For the next release we will implementbackup locksthat will avoid us to run FTWRL.

    The postmydumper [less] lockingappeared first onMySQL Performance Blog.

    Published at DZone with permission ofPeter Zaitsev, author and DZone MVB. (source)

    (Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

    Tags:
  • MySQL
  • Tips and Tricks
  • Performance
  • 文档

    Mydumper[less]locking_MySQL

    Mydumper[less]locking_MySQL:07.01.2014|10 views|Related MicroZone ResourcesAppOps: Power to the Devs!FREE Top 10 Java Performance Problems EBookUshering in a New Era of APM for the EnterprisePerformance in the Enterprise: A Survival Guide4 Success stories of APM for
    推荐度:
    标签: mysql less locking
    • 热门焦点

    最新推荐

    猜你喜欢

    热门推荐

    专题
    Top