mongodb副本设置读锁定

发布于 2025-01-01 06:14:45 字数 155 浏览 5 评论 0原文

我们有一个 Mongo 副本集,在三个数据中心有三个节点。其中两个带有数据,另一个是仲裁器。

我们在主节点中进行压力写入,几乎 100% 锁定,因此我们在副本节点(辅助节点)中进行读取。我们的问题是,由于这些写入,辅助设备中的读取速度也很慢。

我们是否遗漏了什么?

We have a Mongo Replica Set with three nodes in three datacenters. Two of them with data and the other one is an arbitrer

We are doing stressful writes in the primary with almost 100% of locking so we are doing the reads in the replica node (secondary). Our problem is that the reads are slow too in the secondary due to those writes.

Are we missing anything?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

忱杏 2025-01-08 06:14:45

我们在主节点中进行压力写入,几乎 100% 锁定,因此我们在副本节点(辅助节点)中进行读取。我们的问题是,由于这些写入,辅助设备中的读取速度也很慢。

当您对主数据库执行写入时,该写入也必须在辅助数据库上执行。因此,辅助设备正在执行与主设备相同的工作。

因此,如果您在主数据库上有 100% 锁定,那么在辅助数据库上也有 100% 锁定。

将读取转移到辅助节点可能不会有帮助,因为主节点上的 IO 可能已完全锁定,因此无法跟上。

运行 iostat 和 top 并找出瓶颈所在。您可能需要电源,但这可能只是索引问题。

We are doing stressful writes in the primary with almost 100% of locking so we are doing the reads in the replica node (secondary). Our problem is that the reads are slow too in the secondary due to those writes.

When you perform a write to the primary, that write also has to be performed on the secondary. So the secondary is doing the same work as the primary.

So if you have 100% locking on the primary, you have 100% locking on the secondary.

Moving reads to the secondary probably won't help because your IO on the primary is probably completely locked so it can't keep up.

Run iostat and top and figure out where the bottleneck is. It's likely that you'll need power, but it may just be an indexing problem.

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