Hi Team,
We are configure atlas cluster M20 tier for development purpose. Multiple applications are connected to this cluster. We are recently facing some connection issues, getting too many connections from applications. In that I have observed some are in idle state.
db.getSiblingDB("admin").aggregate( [
{ $currentOp : { allUsers: true , idleConnections:true} },
{ $match : {active:false } },{$count:"idleConnections"}
] );
Result :
{
idleConnections: 504
}
for these idleConnections I did not found opid to kill them with scheduler. Currently we are working on Connection pooling, and required manual killing of these idleConnections…
I am able to kill idleSessions but I am unable to kill idleConnections…
// Killing idleSessions
db.getSiblingDB("admin").aggregate( [
{ $currentOp : { allUsers: true , idleSessions:true} },
{ $match : {active:true } }
] ).forEach(op=> {
print(`killing connectionId : ${op.connectionId} , opid : ${op.opid}...`);
var killStatus = db.killOp(op.opid);
op.killStatus = killStatus;
db.getSiblingDB("sessions_killing").getCollection("idleSessions").insertOne(op);
});
Is there any way to kill these idleConnection manually using schedulers ?
Please do needful …
Thanks in advance.