Skip to content
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

Reduce how often we hit the database #1783

Merged
merged 3 commits into from
Oct 1, 2021

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Sep 28, 2021

What does this change

  • Consolidate creating indices into just 3 calls. We can further refine this in Move database initialization overhead into an init function #1782, when we make initializing the db a single event.
  • Do not ping on connect in the mongodb plugin. This does mean that the first query will be slower as it will establish the connection. So let's be aware of that and not assume the first call just has horrible performance.

I am still looking into why the first call that establishes the connection has bad performance. https://www.mongodb.com/community/forums/t/establishing-a-connection-is-slow/125826

What issue does it fix

I was creating each index in its own call but there's actually a different function on the mongodb client that I can use to batch those calls up to improve performance.

Notes for the reviewer

NA

Checklist

  • Unit Tests
  • Documentation
  • Schema (porter.yaml)

Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

LGTM, pending CI passing.

@carolynvs
Copy link
Member Author

Sorry about the test, those seem to be flakes that are only failing on CI. I assume my dev machine is beefy enough that's why I'm getting different (better) timings.

I'll flail about on this with CI until it passes consistently!

* Consolidate creating indices into just 3 calls. We can further refine
this in getporter#1782, when we make initializing the db a single event.
* Do not ping on connect. This does mean that the first query will be
slower as it will establish the connection. So let's be aware of that
and not assume the first call just has horrible performance.

I am still looking into why the first call that establishes the
connection has bad performance.

Signed-off-by: Carolyn Van Slyck <[email protected]>
When we set pkg.Version in a test, it should not run in parallel and
should reset changes to those global variables when complete.

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs
Copy link
Member Author

Yay! Fixed some test timeouts and we are good to go. 💨

@carolynvs carolynvs merged commit a019ac8 into getporter:release/v1 Oct 1, 2021
@carolynvs carolynvs deleted the too-chatty branch October 1, 2021 16:10
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.

2 participants