主从复制考虑副本延迟
我正在生产中开发 Ruby on Rails 应用程序。
该应用程序需要主/从数据库复制。
我正在使用 octopus gem 来做到这一点。
问题是我有一个在过去一周左右工作的临时环境,在该临时环境中我在亚马逊 RDS 上设置了警报。
我发现副本延迟有时是 10 秒(有时甚至是 100 秒)。
考虑到我有多个实例在运行,所有实例都在负载均衡器下运行,并且我还运行后台作业(使用 Resque),您将如何在应用程序中处理这个问题?
I am working on a Ruby on rails application in production.
This application needs master/slave database replication.
I am using the octopus gem to do that.
The problem is that I have a staging env working for the past week or so, in that staging env I have setup alerts on amazon RDS.
I see that the replica latency is sometimes 10 seconds (it's even 100 seconds sometimes).
How would you handle that in your application, thinking that I have several instances running, all under a load balancer, and I also have background jobs running (using Resque)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在寻找简单的
主/从
数据复制,您是否考虑过在数据库而不是应用程序级别执行此操作。我使用
MySQL
复制运行多个主/从
和主/主
设置,这往往会在相当快的速度上保持非常低的复制延迟<代码>WAN连接。它不是同步的,但听起来在这种情况下这不是必需的。If you are looking for a simple
master/slave
replication of data, have you considered doing this at the database rather than application level.I run several
master/slave
andmaster/master
setups usingMySQL
replication, which tends to keep the replication latency very low on a reasonably fastWAN connection
. It's not synchronous, but it sounds like that's not a requirement in this case.