I’m working on a multi-threading C server where I use mongo as database.
For that, I’m using the mongo connection pooling. When my server process multiple connections, I have noticed very high CPU usage by my application due to multiple mongo connections.
My questions are :
Is it possible to avoid opening multiple connections each time we pop a mongo client ?
Is it possible to execute mongo operations after pushing a mongo client to the pool ? (as it shown below) :
mongoc_client_t *client; client = mongoc_client_pool_pop (pool); collection = mongoc_client_get_collection(client, "database", "collection"); mongoc_client_pool_push (pool, client); // Use collection to insert, get or update documents after pushing the mongo client