[SERVER-64966] Count how many pooled connections are created, but never used Created: 25/Mar/22  Updated: 29/Oct/23  Resolved: 24/May/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Task Priority: Major - P3
Reporter: George Wangensteen Assignee: Reo Kimura (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by TOOLS-3134 Investigate changes in SERVER-64966: ... Closed
Documented
is documented by DOCS-15357 [Server] Investigate changes in SERVE... Closed
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Service Arch 2022-04-18, Service Arch 2022-05-02, Service Arch 2022-05-16, Service Arch 2022-05-30
Participants:
Linked BF Score: 170

 Description   

To learn more about the efficiency of our connection pools and their sizing algorithms, we'd like to know how often we create connections that never end up being used to run operations. Let's add a metric to count the number of connections created by our connection pools that are never used to run an operation; i.e. that expire/are destroyed before they are ever used. 



 Comments   
Comment by Githook User [ 24/May/22 ]

Author:

{'name': 'Reo Kimura', 'email': 'reo.kimura@mongodb.com', 'username': 'rkimura21'}

Message: SERVER-64966 Count how many pooled connections are created, but never used
Branch: master
https://github.com/mongodb/mongo/commit/0c0e43f92b0039f634e9c25f78e65d6be95d10ef

Comment by Vojislav Stojkovic [ 01/Apr/22 ]

When a connection is used to run an operation, its indicateUsed() method will be called. Currently, the only effect of that is to update its _lastUsed timestamp. We can modify the ConnectionInterface class to keep track of whether the connection was ever used and then check that when the connection is dropped, so that we can record the observation.

There are currently two places in code where we would have to perform this check: inside ConnectionPool::SpecificPool::returnConnection and inside ConnectionPool::SpecificPool::finishRefresh.

To report this metric to the users, we can add a counter to the ConnectionStatsPer class and then include it in the serialization in ConnectionPoolStats::appendToBSON. The contents of this class are populated on demand inside the ConnectionPool::appendConnectionStats function, so the actual bookkeeping would have to be done inside the ConnectionPool::SpecificPool class, just like it's done for inUseConnections(), availableConnections(), etc.

Generated at Thu Feb 08 06:01:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.