Mysql master master with high latency

multi-masterMySQLperconareplication

We have a single master setup with many slaves in germany and some slaves in australia.

To have faster writes in australia we want a master-master setup between germany and australia. Read slaves will remain under the local master in both regions.

We tested Percona XtraDB Cluster, but the commits are synchronous, and writes are way too slow.

Is there an option in XtraDB to speed things up? Maybe tranfer multiple transactions in one block between the two masters? Or allow commits to be accepted before the second nodes applied it?

Is there another master-master solution, that works better (maybe asynchronously) under the given high latency of ~300ms?

Best Answer

PXC (and other Galera solutions) require one network hop at COMMIT time. If your application can combine writes into a single transaction, that will help at some level. However, still each COMMIT will take 300ms (or whatever it is).

Regular MySQL can do Master-Master and have both writable. That replication is asynchronous. However, there are a number of caveats. Auto_increments should be configured with auto_increment_offset and _increment. UNIQUE indexes are problematic; the app must figure out how to avoid 'simultaneous' insertion of the same UNIQUE value on both continents. Note that replication will simply stop until you manually do something.

Another possibility is NDB Cluster. However, that has a lot of differences in the syntax and functionality. The advantage is that it is "eventually consistent". You set up rules about what to do if, say, duplicate keys are inserted.

There's an old saying: You can have any of X or Y or Z; pick 2. So, I ask, what are your 2 reasons for wanting multi-Master? And what 3rd item are you willing to sacrifice. (It sounds like latency is not #3.)