MySQL 5.7.2 features enhanced Multi-threaded slave which
can be used to apply transactions in parallel even within a
single database. Internal details of its working can be found in
an earlier post. In this post we will
see how we can configure our replication slave to use this
enhancement.
MySQL 5.7.2 has a new system variable
--slave-parallel-type which is dynamic. It can
be set to the following values:
1. DATABASE : (Default) Use the db partitioned MTS
(1 worker per database)
2. LOGICAL_CLOCK: Use logical clock based
parallelization mode.
Apart from this the original option of
--slave-parallel-workers=N is still valid and it sets that
number of workers that we need to spawn. Also since the slave
leverages the group of transactions that have …
IntroductionRe-applying binary logs generated from highly
concurrent master on the slave has always been an area of focus.
It is important for various reasons. First, in real-time systems,
it becomes extremely important for the slave to keep up with the
master. This can only be guaranteed if the slaves’ performance in
reapplying the transactions from the binary log is similar (or
at-least comparable) to that of master, which is accepting
queries directly from multiple clients. Second, in synchronous
replication scenarios, having a fast slaves, aids in reducing the
response times as seen by the clients to the master. This can be
made possible by applying transactions from the binary log in
parallel. However if left uncontrolled, a simple round-robin
multi-threaded applying will lead to inconsistency and the slave
will no longer be the exact replica of the leader.
The infamous out of order commit problemThe Out of order
execution of transaction …