Reduce the connection pool size in the clients You can also manage custom resource limits (such as connections per client) via your API, based on the credentials the client uses to connect. For example, you could move your database server or reconfigure from a standalone to a replica set, and the clients would not have to be aware of this. This approach gives you an extra layer of abstraction so you can manage resource usage and server deployment independent of the client configuration. If you are managing a shared server with resource limits, it is common to provide your own API rather than direct database access. For more best practices, I would recommend reviewing the Production Notes in the MongoDB manual. You can check current and available connections in the mongo shell via: db.serverStatus().connectionsįor production systems it is typical to adjust the ulimit settings on Linux to allow more concurrent connections. Typically Linux distributions limit file descriptors per process to 1024, of which MongoDB will use 80% for incoming connections (leaving about 819 available connections). The total incoming connection limit on the server is determined by the lesser of the limits imposed by the operating system or maxIncomingConnections (aka maxConns in MongoDB 2.4 and earlier). Increase the connections allowed on the server I've listed some alternatives for connection management below, in order of most to least recommended.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |