Choosing between Codership’s
MySQL Galera, MariaDB Galera
Cluster and Percona XtraDB Cluster
Colin Charles, colin.charles@galeracluster.com
12 December 2019
https://twitter.com/galeracluster | www.galeracluster.com
Codership Webinar
Agenda
• What is Galera Cluster?
• Who develops Galera Cluster?
• Why are there distributions?
• Understanding the MySQL/MariaDB bases
• Going deeper into the cluster differences
• MySQL 8 + Galera 4
This is a rare webinar…
• Because we will be introducing and talking about products that aren’t made
by Codership, the makers and engineers behind Galera Cluster
• We will talk about the various distributions of Galera Cluster that exist
What is Linux?
• Linux is a kernel
• There are many distributions of operating systems that include the Linux
kernel that you are familiar with
• e.g. Red Hat Enterprise Linux (RHEL), Ubuntu, Fedora, etc.
What is Galera Cluster?
• It is an advanced database clustering software that provides for no data
loss, great uptime, and scalability for growth
• It is truly multi-master based on (virtually) synchronous replication
• This is the solution for High Availability
So… what is Galera then?
• A generic replication plugin for database servers
• Uses the replication API to interact with a DBMS (via the wsrep API
project, fully open source on GitHub)
• wsrep == writeset replication
• The database and Galera plugin must have the same wsrep API version
Who developed it?
• The developers and experts of Galera Cluster
• Established in 2007, 3 founders, all engineers
• Seppo Jaakola, CEO, Teemu Ollakka, CTO, Alex Yurchenko, architect
• Services business model, producing 100% open source software
• Thousands of users in various industries: e-commerce, betting/gambling,
telecoms, banking, insurance, gaming, healthcare, media, marketing,
advertising, travel, education, SaaS, PaaS, IaaS, etc.
Why are there distributions then?
• Because like Linux, the MySQL ecosystem is wide and varied
• Codership chooses to make a MySQL version, currently for 5.5, 5.6 and
5.7 (with 8.0 coming)
• Codership works closely with MariaDB Corporation to make MariaDB
Galera Cluster
• Percona has a branch (fork?) that ports changes from the MariaDB tree, as
well as the Codership tree
What is different at
the base?
Codership MySQL Galera Cluster
• MySQL base version + Galera Cluster
• The latest, greatest, Galera Cluster
• Codership plans the roadmaps of Galera Cluster and the new features,
bug fixes, etc.
• This is the most “pristine” and naturally recommended version of Galera
Cluster to use :-)
Percona Server for MySQL
• Percona Server for MySQL builds on top of MySQL, aims always to be a
more performant branch of MySQL
• Has some features that are not present in MySQL:
• MyRocks, TokuDB storage engines (not usable with Galera Cluster),
more instrumentation around user statistics, slow query logging,
improved MEMORY engine (not usable with Galera Cluster), parallel
InnoDB doublewrite buffer (XtraDB), compressed columns with
dictionaries, PAM authentication plugin, audit plugin, Vault plugin for
encryption, changed page tracking in InnoDB, extended SHOW
GRANTS, kill idle transactions, etc.
MariaDB Server
• Feature compatible, drop-in replacement, fork of MySQL
• So many storage engines! (e.g. MyRocks, Aria, TokuDB, CONNECT,
SPIDER)
• Better for DBAs, e.g. group commit in binlog, parallel replication, support
for Oracle syntax, table elimination, and a whole lot more
• It is a database by itself in it’s own right!
MariaDB Server II
• Oracle compatibility (including SEQUENCES, PL/SQL)
• More storage engines but also a completely new (forked) InnoDB
• Temporal data via system versioned tables
• Galera Cluster 4.0!
• Security improvements and changes
• Optimiser improvements
• Replication & Backup
• Compression
• Invisible columns
• Instant ADD COLUMN
• Plus some of the features from 10.2+10.1+10.0+5.5+5.3+5.2+5.1 that may not be in stock MySQL
So… what about the Galera Cluster enhancements?
• Percona XtraDB Cluster (PXC) and MariaDB Galera Cluster build on-top of
their existing changes and embed the wsrep library, and provide for Galera
Cluster in their own distributions
• So in a way, you get the ability to use the threadpool with MariaDB Galera
Cluster (the core server features are also exposed when the replication library
itself gets replaced)
• SQL_MODE=ORACLE will continue parsing whatever Oracle/PL/SQL that
MariaDB Server can parse, with a Galera Cluster backend too!
• Possibilities are endless when you start thinking about future SPIDER support
with Galera Cluster
Percona XtraDB Cluster (PXC)
• Integrated Percona XtraBackup
• Integrated ProxySQL as a load balancer/proxy (with configuration script)
• “Strict Mode”, e.g. disallow MyISAM, tables without primary keys, ROW binlog_format,
logging to a file (not tables), innodb_autoinc_lock_mode set to 2, etc.
• Automatic configuration of SSL encryption (pxc-encrypt-cluster-traffic variable)
• InnoDB improvements (via XtraDB) around full-text search, page fragmentation counters
• Integration with Percona Monitoring & Management (PMM)
• Encryption via keyring_vault or keyring_file plugins (considered beta)
MariaDB Galera Cluster
• Fully integrated into MariaDB Server (all in one download)
• Only one shipping with Galera 4 (MariaDB 10.4 — before that Galera 3)
• Can do rolling upgrades from Galera 3 to Galera 4
• Hint of new Galera 4 features exist:
• Streaming replication (support for large transactions)
• Group commit support
• Use of backup locks (mariabackup SST with a “lightweight lock”)
• Everything in MariaDB Server is available to use in Galera Cluster (as long as Galera supports it, so
not the SPIDER engine, etc.)
Branch variants
Some feature highlights of Galera 3.x and 4
• Intelligent donor selection, preferring a donor that can do an Incremental State
Transfer (IST)
• Cluster crash recovery, say, after a power failure via pc.recovery=ON so all
nodes maintain cluster information persistently, not requiring a bootstrap
• Streaming replication, which replicates transactions of any size; transaction
replicated in small increments. Huge transaction support!
• Consistency voting protocol in the event of inconsistencies, all nodes vote
when such is detected
• DDL optimisation, so the lock only applies to the affected table
Galera replication versions
• There have been many major releases (1,2,3)
• Current production head is at 3.26
• There have been many wsrep API versions (1..25)
• Next major version is wsrep API 26 which corresponds with Galera 4
• There are wsrep API changes that require you to perform a rolling upgrade
MySQL 8 + Galera 4
• This is to be released Q1/2020
• I have already been playing with an internal beta on CentOS 7
• We are working out some bugs, but it will be done soon!
• MySQL GTID sequence numbers are generated from Galera seqno, so there can
be holes in the streaming replication fragments, rolled back transactions or
transactions with failed certification
• wsrep_cluster_address must be set in mysqld_bootstrap script (easyfix)
• X Protocol/Plugin is not supported yet (but is working in a tree already, so you can
query with Python/JavaScript in theory)
Streaming Replication
• The base for supporting huge transactions
• In Galera Cluster 3, a transaction processes on the “master node” (i.e.
node that client connected to, to execute the transaction) until commit time
• For large transactions, the writeset will be large, hard to process
• So wsrep_max_ws_size exists to prevent large transactions
Streaming Replication
• This is new in Galera Cluster 4 to enable running transactions of unlimited
size in a cluster
• You can of course still reject large transactions
What is a large transaction?
• LOAD DATA that is large…?
• wsrep_max_ws_rows and wsrep_max_ws_size. Limit the transaction rows
to 128 KB and the transaction size to 1 GB. wsrep_max_ws_size has a
maximum upper limit of 2GB, beyond which it is rejected
• Guide to handle large transactions:
http://galeracluster.com/library/kb/best/large-transactions.html including the
use of pt-archiver
• One practical test: https://www.percona.com/blog/2015/10/26/how-big-can-
your-galera-transactions-be/
Streaming Replication
• Transactions are replicated, gradually in small fragments, during transaction
processing
• i.e. before an actual commit, Galera replicates a number of small sized fragments
(transaction fragmentation)
• Size threshold for fragment replication is configurable
• Replicated fragments are applied in slave threads preserving the transaction state in
all cluster nodes
• fragments hold locks in all nodes and cannot be conflicted later
• Streaming replication allows nodes to process writesets greater than 2GB
Configuring Streaming Replication
• Session variables (dynamic):
• wsrep_trx_fragment_unit — unit metrics for fragmenting, options are
bytes (writesets in bytes), rows (number of rows modified), statements
(number of SQL statements issued)
• wsrep_trx_fragment_size — threshold size in units when fragments will
be replicated. 0 means no streaming.
Using Streaming Replication
• Due to excessive logging and elevated replication overhead, streaming
replication will cause degraded transaction throughput rate
• Best use case? Use streaming replication to cut large transactions
• Set the fragment size to around 10,000 rows
• Applications can also set streaming replication on/off on a need-by-need
basis (requires changes to application naturally)
New metadata — wsrep tables in mysql database
• There are some new Galera Cluster system tables
SHOW TABLES FROM mysql LIKE 'wsrep%';
+---------------------------+
| Tables_in_mysql (wsrep%) |
+---------------------------+
| wsrep_cluster |
| wsrep_cluster_members |
| wsrep_streaming_log |
+---------------------------+
wsrep_cluster
• Contains current view of the cluster, some identity information and also cluster capabilities
SELECT COLUMN_NAME FROM information_schema.columns
WHERE table_schema='mysql'
AND table_name='wsrep_cluster';
+------------------+
| COLUMN_NAME |
+------------------+
| cluster_uuid |
| view_id |
| view_seqno |
| protocol_version |
| capabilities |
+------------------+
wsrep_cluster_members
SELECT * FROM mysql.wsrep_cluster_members ORDER BY node_name G
*************************** 1. row ***************************
node_uuid: e39d1774-7e2b-11e9-b5b2-7696f81d30fb
cluster_uuid: bd5fe1c3-7d80-11e9-8913-4f209d688a15
node_name: galera1
node_incoming_address: AUTO
*************************** 2. row ***************************
node_uuid: eb8fc512-7e2b-11e9-bb74-3281cf207f60
cluster_uuid: bd5fe1c3-7d80-11e9-8913-4f209d688a15
node_name: galera2
node_incoming_address: AUTO
*************************** 3. row ***************************
node_uuid: 2347a8ac-7e2c-11e9-b6f0-da90a2d0a563
cluster_uuid: bd5fe1c3-7d80-11e9-8913-4f209d688a15
node_name: galera3
node_incoming_address: AUTO
wsrep_streaming_log
• contains meta data and row events for ongoing streaming transactions,
writeset fragment per row
• SELECT * FROM mysql.wsrep_streaming_log G
wsrep functions
• WSREP_LAST_SEEN_GTID() — returns GTID for last written transaction
observed by client
• WSREP_LAST_WRITTEN_GTID() — returns GTID of the last write
transaction made by the client
• WSREP_SYNC_WAIT_UPTO_GTID() — blocks the client until the node
applies and commits the given transaction
gcache encryption
• Today the logs are all completely encrypted with the exception of the
gcache
• ibdata, redo log, binlog, etc.
• now the gcache can also be encrypted
Non-blocking DDL
• Supremely important, lots of people want this, e.g. shared hosting
companies
• Need to upgrade a WordPress database? Lock all writes on all databases
served on the cluster when you run wp-upgrade.php
Percona XtraDB Cluster (PXC) 8?
• Yes, there is a branch of this, early release, based on porting from
MariaDB Server 10.4
• It does not have all the features of MySQL 8 + Galera 4 that come from
Codership (yet)
In summary
• Who are the developers of Galera Cluster? Codership.
• Who has the most developers of Galera Cluster? Codership.
• Who knows the code better than anyone? Codership.
• Who decides the roadmap for Galera Cluster? Codership. With our main
partner, MariaDB Corporation, and listening closely to the community.
Codership…
• Buy from us!
• We have great 24/7 support plans, consulting, training, remote DBA, etc.
• Speak to our friendly sales consultants!
• P/S: If there are features you would like to see, speak to us. We are more
than happy to want to implement them
Questions?
Colin Charles, colin.charles@galeracluster.com
https://twitter.com/galeracluster | www.galeracluster.com
37

Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona XtraDB Cluster

  • 1.
    Choosing between Codership’s MySQLGalera, MariaDB Galera Cluster and Percona XtraDB Cluster Colin Charles, colin.charles@galeracluster.com 12 December 2019 https://twitter.com/galeracluster | www.galeracluster.com Codership Webinar
  • 2.
    Agenda • What isGalera Cluster? • Who develops Galera Cluster? • Why are there distributions? • Understanding the MySQL/MariaDB bases • Going deeper into the cluster differences • MySQL 8 + Galera 4
  • 3.
    This is arare webinar… • Because we will be introducing and talking about products that aren’t made by Codership, the makers and engineers behind Galera Cluster • We will talk about the various distributions of Galera Cluster that exist
  • 4.
    What is Linux? •Linux is a kernel • There are many distributions of operating systems that include the Linux kernel that you are familiar with • e.g. Red Hat Enterprise Linux (RHEL), Ubuntu, Fedora, etc.
  • 5.
    What is GaleraCluster? • It is an advanced database clustering software that provides for no data loss, great uptime, and scalability for growth • It is truly multi-master based on (virtually) synchronous replication • This is the solution for High Availability
  • 6.
    So… what isGalera then? • A generic replication plugin for database servers • Uses the replication API to interact with a DBMS (via the wsrep API project, fully open source on GitHub) • wsrep == writeset replication • The database and Galera plugin must have the same wsrep API version
  • 7.
    Who developed it? •The developers and experts of Galera Cluster • Established in 2007, 3 founders, all engineers • Seppo Jaakola, CEO, Teemu Ollakka, CTO, Alex Yurchenko, architect • Services business model, producing 100% open source software • Thousands of users in various industries: e-commerce, betting/gambling, telecoms, banking, insurance, gaming, healthcare, media, marketing, advertising, travel, education, SaaS, PaaS, IaaS, etc.
  • 8.
    Why are theredistributions then? • Because like Linux, the MySQL ecosystem is wide and varied • Codership chooses to make a MySQL version, currently for 5.5, 5.6 and 5.7 (with 8.0 coming) • Codership works closely with MariaDB Corporation to make MariaDB Galera Cluster • Percona has a branch (fork?) that ports changes from the MariaDB tree, as well as the Codership tree
  • 9.
    What is differentat the base?
  • 10.
    Codership MySQL GaleraCluster • MySQL base version + Galera Cluster • The latest, greatest, Galera Cluster • Codership plans the roadmaps of Galera Cluster and the new features, bug fixes, etc. • This is the most “pristine” and naturally recommended version of Galera Cluster to use :-)
  • 11.
    Percona Server forMySQL • Percona Server for MySQL builds on top of MySQL, aims always to be a more performant branch of MySQL • Has some features that are not present in MySQL: • MyRocks, TokuDB storage engines (not usable with Galera Cluster), more instrumentation around user statistics, slow query logging, improved MEMORY engine (not usable with Galera Cluster), parallel InnoDB doublewrite buffer (XtraDB), compressed columns with dictionaries, PAM authentication plugin, audit plugin, Vault plugin for encryption, changed page tracking in InnoDB, extended SHOW GRANTS, kill idle transactions, etc.
  • 12.
    MariaDB Server • Featurecompatible, drop-in replacement, fork of MySQL • So many storage engines! (e.g. MyRocks, Aria, TokuDB, CONNECT, SPIDER) • Better for DBAs, e.g. group commit in binlog, parallel replication, support for Oracle syntax, table elimination, and a whole lot more • It is a database by itself in it’s own right!
  • 13.
    MariaDB Server II •Oracle compatibility (including SEQUENCES, PL/SQL) • More storage engines but also a completely new (forked) InnoDB • Temporal data via system versioned tables • Galera Cluster 4.0! • Security improvements and changes • Optimiser improvements • Replication & Backup • Compression • Invisible columns • Instant ADD COLUMN • Plus some of the features from 10.2+10.1+10.0+5.5+5.3+5.2+5.1 that may not be in stock MySQL
  • 14.
    So… what aboutthe Galera Cluster enhancements? • Percona XtraDB Cluster (PXC) and MariaDB Galera Cluster build on-top of their existing changes and embed the wsrep library, and provide for Galera Cluster in their own distributions • So in a way, you get the ability to use the threadpool with MariaDB Galera Cluster (the core server features are also exposed when the replication library itself gets replaced) • SQL_MODE=ORACLE will continue parsing whatever Oracle/PL/SQL that MariaDB Server can parse, with a Galera Cluster backend too! • Possibilities are endless when you start thinking about future SPIDER support with Galera Cluster
  • 15.
    Percona XtraDB Cluster(PXC) • Integrated Percona XtraBackup • Integrated ProxySQL as a load balancer/proxy (with configuration script) • “Strict Mode”, e.g. disallow MyISAM, tables without primary keys, ROW binlog_format, logging to a file (not tables), innodb_autoinc_lock_mode set to 2, etc. • Automatic configuration of SSL encryption (pxc-encrypt-cluster-traffic variable) • InnoDB improvements (via XtraDB) around full-text search, page fragmentation counters • Integration with Percona Monitoring & Management (PMM) • Encryption via keyring_vault or keyring_file plugins (considered beta)
  • 16.
    MariaDB Galera Cluster •Fully integrated into MariaDB Server (all in one download) • Only one shipping with Galera 4 (MariaDB 10.4 — before that Galera 3) • Can do rolling upgrades from Galera 3 to Galera 4 • Hint of new Galera 4 features exist: • Streaming replication (support for large transactions) • Group commit support • Use of backup locks (mariabackup SST with a “lightweight lock”) • Everything in MariaDB Server is available to use in Galera Cluster (as long as Galera supports it, so not the SPIDER engine, etc.)
  • 17.
  • 18.
    Some feature highlightsof Galera 3.x and 4 • Intelligent donor selection, preferring a donor that can do an Incremental State Transfer (IST) • Cluster crash recovery, say, after a power failure via pc.recovery=ON so all nodes maintain cluster information persistently, not requiring a bootstrap • Streaming replication, which replicates transactions of any size; transaction replicated in small increments. Huge transaction support! • Consistency voting protocol in the event of inconsistencies, all nodes vote when such is detected • DDL optimisation, so the lock only applies to the affected table
  • 19.
    Galera replication versions •There have been many major releases (1,2,3) • Current production head is at 3.26 • There have been many wsrep API versions (1..25) • Next major version is wsrep API 26 which corresponds with Galera 4 • There are wsrep API changes that require you to perform a rolling upgrade
  • 20.
    MySQL 8 +Galera 4 • This is to be released Q1/2020 • I have already been playing with an internal beta on CentOS 7 • We are working out some bugs, but it will be done soon! • MySQL GTID sequence numbers are generated from Galera seqno, so there can be holes in the streaming replication fragments, rolled back transactions or transactions with failed certification • wsrep_cluster_address must be set in mysqld_bootstrap script (easyfix) • X Protocol/Plugin is not supported yet (but is working in a tree already, so you can query with Python/JavaScript in theory)
  • 21.
    Streaming Replication • Thebase for supporting huge transactions • In Galera Cluster 3, a transaction processes on the “master node” (i.e. node that client connected to, to execute the transaction) until commit time • For large transactions, the writeset will be large, hard to process • So wsrep_max_ws_size exists to prevent large transactions
  • 22.
    Streaming Replication • Thisis new in Galera Cluster 4 to enable running transactions of unlimited size in a cluster • You can of course still reject large transactions
  • 23.
    What is alarge transaction? • LOAD DATA that is large…? • wsrep_max_ws_rows and wsrep_max_ws_size. Limit the transaction rows to 128 KB and the transaction size to 1 GB. wsrep_max_ws_size has a maximum upper limit of 2GB, beyond which it is rejected • Guide to handle large transactions: http://galeracluster.com/library/kb/best/large-transactions.html including the use of pt-archiver • One practical test: https://www.percona.com/blog/2015/10/26/how-big-can- your-galera-transactions-be/
  • 24.
    Streaming Replication • Transactionsare replicated, gradually in small fragments, during transaction processing • i.e. before an actual commit, Galera replicates a number of small sized fragments (transaction fragmentation) • Size threshold for fragment replication is configurable • Replicated fragments are applied in slave threads preserving the transaction state in all cluster nodes • fragments hold locks in all nodes and cannot be conflicted later • Streaming replication allows nodes to process writesets greater than 2GB
  • 25.
    Configuring Streaming Replication •Session variables (dynamic): • wsrep_trx_fragment_unit — unit metrics for fragmenting, options are bytes (writesets in bytes), rows (number of rows modified), statements (number of SQL statements issued) • wsrep_trx_fragment_size — threshold size in units when fragments will be replicated. 0 means no streaming.
  • 26.
    Using Streaming Replication •Due to excessive logging and elevated replication overhead, streaming replication will cause degraded transaction throughput rate • Best use case? Use streaming replication to cut large transactions • Set the fragment size to around 10,000 rows • Applications can also set streaming replication on/off on a need-by-need basis (requires changes to application naturally)
  • 27.
    New metadata —wsrep tables in mysql database • There are some new Galera Cluster system tables SHOW TABLES FROM mysql LIKE 'wsrep%'; +---------------------------+ | Tables_in_mysql (wsrep%) | +---------------------------+ | wsrep_cluster | | wsrep_cluster_members | | wsrep_streaming_log | +---------------------------+
  • 28.
    wsrep_cluster • Contains currentview of the cluster, some identity information and also cluster capabilities SELECT COLUMN_NAME FROM information_schema.columns WHERE table_schema='mysql' AND table_name='wsrep_cluster'; +------------------+ | COLUMN_NAME | +------------------+ | cluster_uuid | | view_id | | view_seqno | | protocol_version | | capabilities | +------------------+
  • 29.
    wsrep_cluster_members SELECT * FROMmysql.wsrep_cluster_members ORDER BY node_name G *************************** 1. row *************************** node_uuid: e39d1774-7e2b-11e9-b5b2-7696f81d30fb cluster_uuid: bd5fe1c3-7d80-11e9-8913-4f209d688a15 node_name: galera1 node_incoming_address: AUTO *************************** 2. row *************************** node_uuid: eb8fc512-7e2b-11e9-bb74-3281cf207f60 cluster_uuid: bd5fe1c3-7d80-11e9-8913-4f209d688a15 node_name: galera2 node_incoming_address: AUTO *************************** 3. row *************************** node_uuid: 2347a8ac-7e2c-11e9-b6f0-da90a2d0a563 cluster_uuid: bd5fe1c3-7d80-11e9-8913-4f209d688a15 node_name: galera3 node_incoming_address: AUTO
  • 30.
    wsrep_streaming_log • contains metadata and row events for ongoing streaming transactions, writeset fragment per row • SELECT * FROM mysql.wsrep_streaming_log G
  • 31.
    wsrep functions • WSREP_LAST_SEEN_GTID()— returns GTID for last written transaction observed by client • WSREP_LAST_WRITTEN_GTID() — returns GTID of the last write transaction made by the client • WSREP_SYNC_WAIT_UPTO_GTID() — blocks the client until the node applies and commits the given transaction
  • 32.
    gcache encryption • Todaythe logs are all completely encrypted with the exception of the gcache • ibdata, redo log, binlog, etc. • now the gcache can also be encrypted
  • 33.
    Non-blocking DDL • Supremelyimportant, lots of people want this, e.g. shared hosting companies • Need to upgrade a WordPress database? Lock all writes on all databases served on the cluster when you run wp-upgrade.php
  • 34.
    Percona XtraDB Cluster(PXC) 8? • Yes, there is a branch of this, early release, based on porting from MariaDB Server 10.4 • It does not have all the features of MySQL 8 + Galera 4 that come from Codership (yet)
  • 35.
    In summary • Whoare the developers of Galera Cluster? Codership. • Who has the most developers of Galera Cluster? Codership. • Who knows the code better than anyone? Codership. • Who decides the roadmap for Galera Cluster? Codership. With our main partner, MariaDB Corporation, and listening closely to the community.
  • 36.
    Codership… • Buy fromus! • We have great 24/7 support plans, consulting, training, remote DBA, etc. • Speak to our friendly sales consultants! • P/S: If there are features you would like to see, speak to us. We are more than happy to want to implement them
  • 37.