在 MongoDB Native 驱动程序上配置理想的 maxPoolSize

发布于 2025-01-20 03:52:24 字数 92 浏览 3 评论 0 原文

MaxPoolsize在杂种量的默认值为100。 如何知道默认值100是否是最佳值?是否有一个公式,一种计算方法来确定理想的MaxPoolsize?

多谢。

The default value for maxPoolSize on the MongoClient is 100.
How would one know if the default value, 100, is the optimal value? Is there a formula, a way of calculating to determine the ideal maxPoolSize?

Thanks a lot.

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

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

发布评论

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

评论(1

私野 2025-01-27 03:52:24

池大小仅取决于您使用的驱动程序,对于node.js最小值为 5 ,默认值为最大值为100(默认值)。

池尺寸有助于使DB的并发请求,这取决于您需要从应用程序创建的并发连接(可以打开的查询)。您可以根据用法增加它 - 您必须一次使用DB进行100多次连接,否则您需要进行一些连接以进行长期运行的任务等。

这些连接当然是基于您正在运行的服务器DB开。 Mongo Atlas确实提供了某些一次可以具有多达1500个连接的群集。

您应该检查帖子以查看它如何影响应用程序性能。

The pool size is solely dependent on the driver you are using, for Node.js minimum is 5 which is default and the maximum is 100(default).

Pool size helps to make the concurrent requests to the DB and it depends upon how much concurrent connection(queries you can run on) you need to create from the application. You can increase it based on your usage- that you have to need more than 100 connections at a time with DB or you need some connections for long-running tasks etc.

And these connections are of course based on the server that you are running the DB on. Mongo atlas does provide certain clusters that can have up to 1500 connections at a time.

You should check this post to see how does it impact application performance.

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