| |
| |
| |
maxPoolSize,或增加应用程序或正在使用的框架中的活动线程数。 | |
maxPoolSize或减少应用程序中的线程数。这可以减少负载和响应时间。 |
Warning
Do not use 不要使用socketTimeoutMS to prevent long-running server operations. Instead, use maxTimeMS() with queries so that the server can cancel long-running operations.socketTimeoutMS来防止长时间运行的服务器操作。相反,在查询中使用maxTimeMS(),这样服务器就可以取消长时间运行的操作。
Calculate Maximum Number of Connections计算最大连接数
Calculate usage to find the number of operations running for each connection.计算使用情况,以找到每个连接运行的操作数。
Consider four application servers connecting to a replica set with three members. In this scenario, each of the four application servers creates a connection pool for each replica set member.考虑四个应用程序服务器连接到一个有三个成员的副本集。在这种情况下,四个应用程序服务器中的每一个都会为每个副本集成员创建一个连接池。
Calculate the maximum number of connections that are opened by each application server by multiplying 通过将maxPoolSize by the number of members.maxPoolSize乘以成员数来计算每个应用程序服务器打开的最大连接数。
Calculate outgoing connections from an application to a three-member replica set:计算从应用程序到三成员副本集的传出连接:
100 (maxPoolSize default 100) x 3 (replica set members)(副本集成员数) = 300 (outgoing connections from the application).(应用程序的输出连接)。
Calculate incoming connections from four application servers to a replica set:计算从四个应用程序服务器到副本集的传入连接:
100 (maxPoolSize default 100) x 4 (application servers)(副本集成员数) = 400 (incoming connections to each mongod).(每个mongod的传入连接)。