Skip to content

GODRIVER-2038 Make all connections in the background using connectTimeoutMS. #716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

matthewdale
Copy link
Collaborator

@matthewdale matthewdale commented Aug 6, 2021

Refactor the Go driver connection pool to establish all new connections in background goroutines.

Changes:

  • Use connectTimeoutMS (default 30s) as the timeout for establishing all new connections.
  • Establish all new connections in background goroutines to separate the connection establishment deadline from the checkOut deadline.
  • Limit the number of new connections created simultaneously to 2 (maxConnecting).
  • Rename functions get() -> checkOut() and put() -> checkIn() to align with CMAP naming.
  • Always disconnect pools created in tests to prevent leaking goroutines and connections.

GODRIVER-2038
GODRIVER-2044

@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 3 times, most recently from 5f9e0d9 to 2def9ae Compare August 12, 2021 00:54
@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 8 times, most recently from 56a3a88 to 1530024 Compare August 24, 2021 20:30
@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 2 times, most recently from 633f69c to c546264 Compare August 24, 2021 23:36
@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 8 times, most recently from ffe57e8 to 6cc7f51 Compare September 7, 2021 23:17
@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 9 times, most recently from 4c6e87d to 184cf7d Compare September 10, 2021 17:21
Copy link
Contributor

@divjotarora divjotarora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 4 times, most recently from 6779ffe to 241b1e3 Compare October 18, 2021 19:48
Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phenominal work. Looks good pending:

  • The removal of WaitQueueTimeoutMS in the PoolCreated event.
  • Rate limit of 10 connections in maintain.

@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch 7 times, most recently from 39c03de to 94c9917 Compare October 19, 2021 22:58
@matthewdale matthewdale force-pushed the godriver2038-background-conns-2 branch from 94c9917 to b0a6da0 Compare October 20, 2021 01:53
Copy link
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Reviewed the latest two commits for the stress test fix, requesting a max of 10 connections in maintain, and disconnect simplification. Nicely done.

@matthewdale matthewdale merged commit 8539500 into mongodb:master Oct 20, 2021
faem pushed a commit to kubedb/mongo-go-driver that referenced this pull request Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants