English 中文(简体)
带有主写和奴隶阅读的数据库复制时长(延时)
原标题:database replication lag (latency) with master-write and slave-reads

我们有一个读写主机和复制的奴隶阅读服务器。 在某些网络使用案例中, 数据被贴上并立即读回服务器。 即刻读取是在读服务器上完成的, 并且由于延迟, 数据尚未更新 。

我知道,这是一个共同的问题,如果有一个复制机制,我们是一个新人,我们非常希望能够就克服这一局面的各种选择提供任何投入。

我现在可以想到几个选择:

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

Thanks, Chris.

最佳回答

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(见http://www.gigaspaces.com/datagrid )是这一领域的主要产品之一,甚至有一个免费社区版可用于商业项目。

问题回答

这取决于您使用的数据库, 以及您想要解决这个问题的级别 。

在数据库一级,您可以尝试研究几个关键词:

  • Replication lag
  • Semisync replication & sync replication

在 MySQL, 你可以发现:

  • MySQL 5.6 (not GA yet)
  • Galera Cluster

如果您想在应用级别上解决这个问题, 那么“ 总是在写后以主读方式读读” 将是一个很好的解决方案 。





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签