主从复制考虑副本延迟

发布于 2024-12-27 15:23:21 字数 327 浏览 7 评论 0原文

我正在生产中开发 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坏尐絯℡ 2025-01-03 15:23:21

如果您正在寻找简单的主/从数据复制,您是否考虑过在数据库而不是应用程序级别执行此操作。

我使用 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 and master/master setups using MySQL replication, which tends to keep the replication latency very low on a reasonably fast WAN connection. It's not synchronous, but it sounds like that's not a requirement in this case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文