Search code examples
databasedatabase-designreplicationscalability

database replication lag (latency) with master-write and slave-reads


We have a read-write master and replicated slave-read servers. In certain web use cases the data is posted and immediately read to be sent back to the server. The immediate read is done on the read-slaves and due to latency the data is not yet updated there.

I understand this could be a common issue with a replication setup, we are new to this, would really appreciate any inputs on the options we have to overcome the situation.

I can think of a few options right now:

  • Always do immediate reads from the master.
  • Decrease Latency by using powerful servers.
  • Do away with replication and shard the DB.

Thanks, Chris.


Solution

  • A common solution to such architecture is using an In Memory Data Grid (IMDG). IMDG (called in some cases Distributed Caching) can help you synchronize between different servers without paying the DB access latency or dealing with developing your own replication mechanism.

    XAP Elastic Caching (See http://www.gigaspaces.com/datagrid) is one of the leading products in this area, and even has a free community edition which can be used in commercial projects.