Not the answer you need?
Register and ask your own question!

Keep alive setting for MongoDB

aforoltaforolt EntrantLegacy User Role Beginner
Noob here. I am wondering if there is any connection keep alive setting for Mongodb. We are seeing a lot of connections being opened from the application and not closing gracefully even after the session is closed. We had to resort to restarting the MongoDB manually to restore the connection pool. Please advise.

THanks

Comments

  • adamo.toneteadamo.tonete Entrant Legacy User Role Supporter
    Hi Aforolt,

    This is managed by the driver. Usually, there is an option to close connections.

    If you're seeing a spike or a huge number of connections open please make sure the application is not creating lots of connection pools and never releasing it.

    This link for java driver might help:

    http://mongodb.github.io/mongo-java-driver/2.13/getting-started/quick-tour/

    Please notice: [h=5]IMPORTANT
    When creating many MongoClient instances:
    [/h]
    • All resource usage limits (max connections, etc) apply per MongoClient instance
    • To dispose of an instance, make sure you call MongoClient.close() to clean up resources
    Regards,
    Adamo
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.