• Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: django
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      In Django's database backend system, the BaseDatabaseWrapper class provides a foundation for creating custom database backends. One of its key methods, get_new_connection, handles database connections.

      Currently, in django-mongodb-backend, a new MongoClient object is created for each request when get_new_connection, and Django closes this connection after the request completes. This approach is inefficient because it incurs the overhead of reestablishing a database connection for every HTTP request.

      A better solution would be to leverage PyMongo's built-in connection pooling. This would maintain persistent connections, reduce connection setup overhead, and improve performance by reusing existing connections rather than creating new ones for each request.

       

            Assignee:
            tim.graham@mongodb.com Tim Graham
            Reporter:
            mostafakhaki00@gmail.com Mostafa Khaki
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: