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

Provider: MaxConnsPerHost tests with creating 60 service accounts #842

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

eleijonmarck
Copy link
Contributor

@eleijonmarck eleijonmarck commented Mar 8, 2023

why/what
We have seen that too many simultaneous calls to grafana API can cause the DB to be congested.

Features

  • tests for creating 60 service accounts
  • limit the number of HTTP connections that each provider can have open

downside
might slow down terraform providers for our users

fixes
#827

@eleijonmarck eleijonmarck requested a review from a team as a code owner March 8, 2023 11:47
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically. To do so, a Grafana Labs employee must promote the Drone build.

For maintainers, it's better to run only the Cloud tests you need, rather than all of them. You can do so by setting the following parameter when promoting:

TESTARGS='-run=<testname>'

@@ -340,6 +340,7 @@ func createGrafanaClient(d *schema.ResourceData) (string, *gapi.Config, *gapi.Cl
auth := strings.SplitN(d.Get("auth").(string), ":", 2)
cli := cleanhttp.DefaultClient()
transport := cleanhttp.DefaultTransport()
transport.MaxConnsPerHost = 2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

limiting the amount of concurrent HTTP connections from the provider makes it not overload the API and DB

Copy link
Member

Choose a reason for hiding this comment

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

Can you make that a comment in the code?

Copy link
Member

@julienduchesne julienduchesne left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -340,6 +340,7 @@ func createGrafanaClient(d *schema.ResourceData) (string, *gapi.Config, *gapi.Cl
auth := strings.SplitN(d.Get("auth").(string), ":", 2)
cli := cleanhttp.DefaultClient()
transport := cleanhttp.DefaultTransport()
transport.MaxConnsPerHost = 2
Copy link
Member

Choose a reason for hiding this comment

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

Can you make that a comment in the code?

@julienduchesne julienduchesne merged commit 97410e5 into master Mar 8, 2023
@julienduchesne julienduchesne deleted the eleijonmarck/serviceaccounts/parallell-calls branch March 8, 2023 13:05
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.

3 participants