MongoDB 在压力下崩溃了

发布于 2025-01-07 21:45:22 字数 403 浏览 3 评论 0原文

我正在测试 mongodb,在大约三周的测试阶段,mongodb 是成功的。但是当我在生产系统中使用它时,mongodb 崩溃了。

在我的场景中,13 个前端服务器通过一台 mongodb 服务器获取 Web 请求,并且 mongodb 集合处理这些插入请求。每分钟插入 650,000 个。通常情况下,我的数据库服务器状态上有 110 个 mongodb 连接。

我每分钟重命名当前集合,然后自动创建我的旧集合。因为大量请求来自前端服务器。我每分钟都会将数据从重命名的集合移动到 SQL Server 数据库。

前 6 小时一切正常。但后来mongodb连接异常增加到3500个连接。当前队列是 1500。并且我的前端服务器无法接收来自 mongodb 的响应。

为什么会出现这个错误,你有什么想法吗?

谢谢。

I am testing mongodb and during my test stage of about three weeks mongodb was successful. But when I use it in my production system then mongodb crashes.

In my scenario 13 front server are getting web request through one mongodb server and mongodb a collection handles these insert requests. 650,000 insert a minute. And normally there is 110 mongodb connections on my db serverstatus.

I rename the current collection every minute and then my old collection is created automatically. Because lots of request coming from front servers. And I am moving the data from the renamed collection to SQL Server Database every minute.

First 6 hours everything is normal. But later mongodb connections are increasing abnormally to 3,500 connections. And the current queue is 1500. And my front servers can't receive response from the mongodb.

Why does this error occur, do you have any idea?

thank you.

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

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

发布评论

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

评论(3

人│生佛魔见 2025-01-14 21:45:22

除了日志之外,您还可以附加 mongostat 的输出吗?这里的信息应该有助于指导您找出可能存在的瓶颈。有关 mongostat 信息的更多信息,请访问 http://www.mongodb.org/display/DOCS/蒙哥斯塔
您在驱动程序中使用哪些安全模式选项?就 fsync 而言,Ravi 正在谈论 mongod 服务器上的 fsync 延迟,并且通过减少 fsync 之间的时间,他迫使数据库更频繁地提交。
您是否在某个时间持续看到这种行为,表明您的客户端流量出现峰值?

Can you attach the output of mongostat in addition to the logs. The information here should help guide you to what could be the bottlenecks. More information on mongostat information can be found at http://www.mongodb.org/display/DOCS/mongostat.
From the driver what SafeMode options are you using? As far as fsync goes Ravi is talking about fsync delay on the mongod server and by reducing the time between fsyncs he is forcing the database to commit more often.
Are you seeing this behavior consistently at a certain time pointing to a spike in traffic from your client side?

逐鹿 2025-01-14 21:45:22

尝试减少-fsync。
调用插入操作和 mongo 实际执行插入操作时是有区别的。

Try reducing -fsync.
There is difference when a insert operation is called and when mongo actually does it.

聊慰 2025-01-14 21:45:22

尝试使用 MongoDB 连接池,这样每次向 mongodb 发出请求时就不会创建新连接。

Try using MongoDB connetion pooling so that no new connection is created upon every request to mongodb.

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