Database Reference
In-Depth Information
Monitor Module
The monitor module is responsible for tracking the replication delay between the
virtualized database master server and each virtualized database replica server.
The replication delay for each replica server is computed by measuring the time
difference of two associated local timestamps committed on the master and the
replica server. Therefore, a Heartbeats database is created in the master and each
synchronized slave database server. Each Heartbeats database maintains a heartbeat
table with two fields: an id and a timestamp . A database request to insert a new
record with a global id and a local timestamp is periodically sent to the master.
Once the insert record request is replicated to the slaves, every slave re-executes the
request by committing the same global id and its own local timestamp. The update
frequency of a record in the master is configurable, named as heartbeat interval in
millisecond unit. The default configuration of the heartbeat interval is set to be 1 s in
the experiments. While records are updated in the master database and propagated
over all slaves periodically, the monitor module maintains a pool of threads that
are run frequently to read up-to-date records from the master and slaves. The read
frequency is also a configurable parameter in millisecond unit, known as monitor
interval . In order to reduce the burden of repetitive read requests on the virtualized
database replica servers, all records are only fetched once, and all local timestamps
extracted from records are kept locally in the monitor module for further calculation.
The replication delay calculation between the master and a slave is initiated
by the corresponding thread of the slave every time after fetching the records.
In the general case of assuming that there are n and k local timestamps in total
in the master array, timestamps m , and the slave array, timestamps s , the slave's i th
replication delay delay Œi is computed as follows:
delayŒi D timestamps s Œi timestamps m Œi
(7.1)
where i k D n and the master and the slave databases are fully synchronized. In
the case of k<nwhere there is partial synchronization between the master and the
slave databases which composes of both a consistent part and an inconsistent part,
the computation of the delay Œi of the slave can be broken into two parts: The delay
of the consistent part with i k is computed using Eq. 7.1 .
The delay of the inconsistent part with k<i n is computed as follows:
delayŒi D timestamps s Œk timestamps m Œk
C timestamps m Œi timestamps m Œk (7.2)
In the case of n<kwhere indeterminacy could happen due to the missing of k C 1 th
local timestamp and beyond (this situation could happen when a recent fetch of the
slave occurs later than the fetch of the master), the delay Œi of the slave uses Eq. 7.1
for i n and the delay Œi of the slave for n<i k will be neglected as there is
no appropriate local timestamps of the master that can be used for calculating the
replication delay. The neglected calculations will be carried out later after the array
of the master is updated.
Search WWH ::




Custom Search