[SERVER-59599] Investigate large delays in connection establishment Created: 25/Aug/21  Updated: 06/Dec/22  Resolved: 28/Oct/21

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Backlog - Service Architecture
Resolution: Cannot Reproduce Votes: 0
Labels: servicearch-q4-2021, servicearch-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-59700 Add programming support for tracepoints Closed
related to SERVER-59617 Pre-warm mongod and mongos connection... Closed
related to SERVER-61084 Remove now-unnecessary ShardingTaskEx... Closed
Assigned Teams:
Service Arch
Operating System: ALL
Participants:
Linked BF Score: 0
Story Points: 6

 Description   

The following is a snippet from SpecificPool::spawnConnections that spawns new connections for connection pools:

// spawn enough connections to satisfy open requests and minpool, while honoring maxpool
void ConnectionPool::SpecificPool::spawnConnections() {
    ...
    for (decltype(allowance) i = 0; i < allowance; ++i) {
        OwnedConnection handle;
        try {
            handle = _parent->_factory->makeConnection(_hostAndPort, _sslMode, _generation);
        } catch (std::system_error& e) {
            ...
        }
        ...
        handle->setup(_parent->_controller->pendingTimeout(),
                      guardCallback([this](auto conn, auto status) {
                          finishRefresh(std::move(conn), std::move(status));
                      }),
                      _parent->getName());
    }
}

This ticket should investigate (and fix) the underlying cause for sporadic large delays (more than 50 milliseconds) in connection establishment.

This delay can be measured by capturing current time (e.g., using _parent->_factory->now()) before calling into TLConnection::setup and before running the callback function.



 Comments   
Comment by Lauren Lewis (Inactive) [ 28/Oct/21 ]

If the linked BF reoccurs, we will re-open this ticket or revisit the issue.

Generated at Thu Feb 08 05:47:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.