← Back to team overview

maria-developers team mailing list archive

Re: parallel replication performance


Axel Schwenke <axel@xxxxxxxxxxxx> writes:

>> In this test, are you sure that you are running MariaDB in GTID mode?
>>     CHANGE MASTER TO master_use_gtid=slave_pos
> Yes. This is how the shell code looks:
> mysql -S ${SLAVE_SOCKET} -u root -e "SET GLOBAL gtid_slave_pos=''"
> mysql -S ${SLAVE_SOCKET} -u root -e "change master to
> master_host='', master_user='rep', master_use_gtid=current_pos"
> mysql -S ${SLAVE_SOCKET} -u root -e "start slave io_thread"
> ok?

Yes, that looks good, thanks for the clarification.

>> 1. MySQL multi-threaded slave compared to MariaDB GTID with different
>> domain_id per database. If MySQL is significantly better here it could
>> indicate some problem in MariaDB parallel replication that should be
>> investigated; this is possible as this part has not been tested a lot.
> I see

Right, so this is something I should investigate.

A couple of things that can be adjusted are --slave-domain-parallel-threads
and --slave-parallel-max-queued. But I wouldn't expect them to have much
effect on a sysbench load. If you want, you could try increase
--slave-parallel-max-queued and set --slave-domain-parallel-threads to 1/32 of
--slave-parallel-threads, to better match what (I think) MySQL multi-threaded
slave is doing.

But its possible there is some performance limitation or bug that I need to

> Actually I haven't tested "MariaDB + multi databases + single GTID
> domain". But I don't expect this the behave significantly different from
> "MariaDB + single database + single GTID domain". Or will it?

No, I would expect it to be much the same.

> Two related questions from me:
> 1. is there an upper limit for the number of trx per commit group? Any
> variables influencing that? commit_wait_count? innodb_log_buffer_size?

There is no upper limit, except that it cannot be larger than the maximum
number of client threads running/

> 2. with multiple GTID domains - do START SLAVE ... UNTIL
> master_gtid_pos=... and MASTER_GTID_WAIT(...) work as expected?

Yes. Assuming your expectations are correct, of course :-)

START SLAVE UNTIL "0-1-100,1-3-300" will replicate in domain 0 until 0-1-100,
and in domain 1 until 1-3-300, and then stop. Note that if there is anything
in domain 2, it will stop immediately (effectively at 2-X-0), so nothing will
be executed in domain 2. Each domain will stop at the right point
independently of the others.

MASTER_GTID_WAIT("0-1-100,1-3-300") will wait for domain 0 to reach 0-1-100,
and then also wait for domain 1 to reach 1-3-300, and then return. It will not
be affected by anything in domain 2.

So the only issue I can think of is that you need to specify all domains in
your START UNTIL and MASTER_GTID_WAIT() commands. You can just use the value
of @@gtid_binlog_pos on the master, I suppose.

> What I expect is this: trx in the binlog/relaylog have a strict order.
> If a position is given per GTID, the terms /before/ and /after/ that
> GTID should be based on the position in the log. Does that hold with
> multiple slave threads?

Hm, I do not think I understand what you are asking here.
Yes, the transactions are strictly ordered in the binlog. But only within each
domain. Transactions/GTIDs in different domains are in principle not ordered
with respect to each other, though of course in any given binlog they will be
seen in _some_ order.

But certainly, if using GTID with parallel replication, it is possible for two
GTIDs with different domains, say 0-1-100 and 1-1-300, to appear in this order
in the master's binlog, but in the opposite order in the slave's binlog.

In contrast, two GTIDs with the same domain id will always occur in the same
order in the master and slave binlogs.

Hope this helps,

 - Kristian.

Follow ups