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

feat(flags): Add query timeout as a limit config #7599

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

rohanprasad
Copy link
Contributor

@rohanprasad rohanprasad commented Mar 17, 2021

In the case of a multi-tenant environment, long-running queries by tenants can consume all the resources, starving the request from other tenants. The change adds query-timeout as a config which will be applied to all the query requests sent without timeout param.

Fixes DGRAPH-3184


This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented Mar 17, 2021

CLA assistant check
All committers have signed the CLA.

@rohanprasad rohanprasad changed the title feat(flags): Add query timeout limit as a limit config feat(flags): Add query timeout as a limit config Mar 17, 2021
Copy link
Contributor

@ahsanbarkati ahsanbarkati left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Contributor

@ahsanbarkati ahsanbarkati left a comment

Choose a reason for hiding this comment

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

Actually, setting 500ms as timeout is causing various tests to fail.

Copy link
Contributor

@NamanJain8 NamanJain8 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @jarifibrahim and @rohanprasad)


dgraph/cmd/alpha/http.go, line 137 at r1 (raw file):

// parses it into time.Duration, empty string is converted into zero value
func parseDuration(r *http.Request, name string, defaultVal time.Duration) (time.Duration, error) {
	value := r.URL.Query().Get(name)

I think we want to over-ride the query timeout set by the user if it is greater than the default value in a multi-tenant setup. @rohanprasad can you confirm this please?


dgraph/cmd/alpha/http.go, line 162 at r1 (raw file):

		return
	}
	queryTimeout, err := parseDuration(r, "timeout", x.Config.QueryTimeout)

This will timeout the query made via HTTP endpoint /query. But the queries made via GRPC (see Server.Query) will not timeout.
I think in a multi-tenant system it will be useful to have a timeout there as well.

Copy link
Contributor Author

@rohanprasad rohanprasad left a comment

Choose a reason for hiding this comment

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

Default set to 0

Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @jarifibrahim, @NamanJain8, and @rohanprasad)


dgraph/cmd/alpha/http.go, line 137 at r1 (raw file):

Previously, NamanJain8 (Naman Jain) wrote…

I think we want to over-ride the query timeout set by the user if it is greater than the default value in a multi-tenant setup. @rohanprasad can you confirm this please?

Confirmed, we don't want to override if the timeout is set by the user


dgraph/cmd/alpha/http.go, line 162 at r1 (raw file):

Previously, NamanJain8 (Naman Jain) wrote…

This will timeout the query made via HTTP endpoint /query. But the queries made via GRPC (see Server.Query) will not timeout.
I think in a multi-tenant system it will be useful to have a timeout there as well.

Will do

@rohanprasad rohanprasad marked this pull request as ready for review March 19, 2021 11:45
Copy link
Contributor

@NamanJain8 NamanJain8 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@rohanprasad rohanprasad merged commit 4238d58 into release/v21.03 Mar 23, 2021
aman-bansal pushed a commit that referenced this pull request Mar 25, 2021
@joshua-goldstein joshua-goldstein deleted the rohanprasad/add_default_query_timeout branch August 11, 2022 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants