how we managed to scale percona xtradb cluster pxc
play

How we managed to scale Percona XtraDB Cluster (PXC) Krunal Bauskar - PowerPoint PPT Presentation

How we managed to scale Percona XtraDB Cluster (PXC) Krunal Bauskar PXC Product Lead @ Percona Agenda PXC Performance Performance fixes PXC Performance PXC Performance 3x-10X Improvement PXC Performance DML execution in MySQL


  1. How we managed to scale Percona XtraDB Cluster (PXC) Krunal Bauskar PXC Product Lead @ Percona

  2. Agenda ▪ PXC Performance ▪ Performance fixes

  3. PXC Performance

  4. PXC Performance 3x-10X Improvement

  5. PXC Performance

  6. DML execution in MySQL PARSE OPTIMIZE REWRITE EXECUTE COMMIT

  7. DML execution in MySQL PARSE OPTIMIZE REWRITE PREPARE EXECUTE COMMIT COMMIT

  8. MySQL Group Commit Protocol ● MySQL Group Commit protocol Batch transactions in group and let leader perform the action while followers wait. ○ ○ Batching actions like flush, sync, commit (including redo flush) help reduce number of fsync and achieve better throughput. 1. FLUSH BINARY LOG (also flushed REDO log) 2. SYNC BINARY LOG 3. COMMIT TRANSACTION in Storage Engine

  9. PXC Commit Monitor ● PXC follow strict commit ordering Transaction that commits first to the group channel should be first to get ○ committed too. ○ Each Transaction is assigned a unique identifier when it replicates on group channel seqno=1 seqno=2 Enforcement is done using commit seqno=3 ordering seqno=4

  10. Commit Protocol ● Binary Log enabled ○ Old Commit Protocol ○ New Commit Protocol ● Binary Log disabled ○ Old Commit Protocol ○ New Commit Protocol

  11. Old-Commit Protocol - Binary log enabled

  12. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  13. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state MySQL GROUP COMMIT starts with enqueuing of Commit InnoDB transaction Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  14. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  15. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  16. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  17. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  18. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  19. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  20. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit InnoDB Exit Sync BINARY transaction in CommitMonitor Log memory pxc action Since binary log is flushed, mysql action REDO log capturing commit of transaction can be prepare phase flushed later. commit phase

  21. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled 5 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state Commit Monitor will allow only one transaction to enter Commit InnoDB through it and there-by Exit Sync BINARY transaction in SERIALIZING CommitMonitor Log memory all the following steps. Since binary log is flushed, Each transaction results in REDO log capturing commit fsync. No batch commit of transaction can be advantage explored. flushed later.

  22. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled 5 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state GOAL is to maintain COMMIT Commit InnoDB Exit Sync BINARY transaction in ORDERING CommitMonitor Log memory Since binary log is flushed, REDO log capturing commit of transaction can be flushed later.

  23. Old-Commit Protocol - Binary log enabled ● Binary Logging is enabled 5 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state MySQL already enforces COMMIT ORDERING and also takes advantage of batch Commit InnoDB Exit Sync BINARY transaction in commit using CommitMonitor Log memory GROUP COMMIT PROTOCOL Since binary log is flushed, REDO log capturing commit of transaction can be flushed later.

  24. New-Commit Protocol - Binary log enabled

  25. New-Commit Protocol - Binary log enabled ● Help accelerate both paths (binary log enabled/disabled) 4 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync Flush BINARY to reflect PREPARE group-channel CommitMonitor REDO Log Log state CHANGE-1 replicate and commit ordering Commit InnoDB Exit Sync BINARY doesn’t need to go together. transaction in CommitMonitor Log commit ordering can be memory enforced after transaction has update UNDO state to prepare.

  26. New-Commit Protocol - Binary log enabled ● Help accelerate binary log enabled path 1 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync to reflect PREPARE Interim Commit group-channel CommitMonitor REDO Log state CHANGE-2 Grab commit monitor Commit InnoDB Sync BINARY Flush BINARY immediately after PREPARE transaction in Log Log memory and release it once transaction is added to GROUP COMMIT QUEUE.

  27. New-Commit Protocol - Binary log enabled ● Help accelerate binary log enabled path 1 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync to reflect PREPARE Interim Commit group-channel CommitMonitor REDO Log state Each transaction is added to Commit InnoDB commit queue maintained by Sync BINARY Flush BINARY transaction in MySQL Group Commit Protocol. Log Log memory Group Commit enforces ordering so Commit Monitor is no more needed to enforce the same post this point.

  28. New-Commit Protocol - Binary log enabled ● Help accelerate binary log enabled path 1 steps critical section Update UNDO log REPLICATE to Enter Flush/Sync to reflect PREPARE Interim Commit group-channel CommitMonitor REDO Log state We still need to enter and Commit InnoDB exit CommitMonitor to Sync BINARY Flush BINARY transaction in Log Log enforce ordering of memory transaction based on the global seqno assigned them during replicate.

  29. Old-Commit Protocol - Binary log disabled

  30. Old-Commit Protocol - Binary log disabled REPLICATE to Enter Update UNDO log to Flush/Sync REDO Flush BINARY Log group-channel CommitMonitor reflect PREPARE state Log ● Binary Logging is disabled Commit InnoDB Exit CommitMonitor transaction in Sync BINARY Log memory Commit InnoDB REPLICATE to Enter Flush/Sync REDO Update UNDO log to transaction in group-channel CommitMonitor reflect PREPARE state Log memory Exit Flush/Sync REDO CommitMonitor Log 4 steps critical section

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend