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

perf: Speed up parsing of a huge query with a lot of conditional mutations #7871

Merged
merged 4 commits into from
Sep 23, 2021

Conversation

Phill240
Copy link

@Phill240 Phill240 commented May 31, 2021

Recently I faced a situation when my queries containing a lot of conditional mutations (+5000) took a long time to process. According to the servers reply the slowest part of the query handling was parsing. For example:
parsing_ns:835833349 processing_ns:157596840 encoding_ns:5105536 assign_timestamp_ns:454011 total_ns:1033841289
So the parsing took several times longer that the processing itself!
The reason of the issue is in the ineffective implementation of buildUpsertQuery method. I suggest using String Builder instead of just simple string concatenation. After these changes the parsing speed increased significantly:
parsing_ns:134053025 processing_ns:114263143 encoding_ns:4992320 assign_timestamp_ns:495987 total_ns:286159717


This change is Reviewable

@CLAassistant
Copy link

CLAassistant commented May 31, 2021

CLA assistant check
All committers have signed the CLA.

@NamanJain8
Copy link
Contributor

NamanJain8 commented Jun 8, 2021

Hey @Phill240 , this looks good. Thanks for it.

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.

Thanks for the PR. Nice change. 🎉
Please address the comments and then we can proceed with merging this,

edgraph/server.go Outdated Show resolved Hide resolved
edgraph/server.go Outdated Show resolved Hide resolved
edgraph/server.go Outdated Show resolved Hide resolved
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.

.

@NamanJain8
Copy link
Contributor

Thanks, @Phill240 ! 🎉

@NamanJain8 NamanJain8 merged commit 3103f0e into hypermodeinc:master Sep 23, 2021
mangalaman93 pushed a commit that referenced this pull request Aug 10, 2023
If a mutation has a lot of conditional mutations,
this PR will speed up the parsing of the query.
cherry-pick of PR (#7871)
mangalaman93 added a commit that referenced this pull request Aug 10, 2023
If a mutation has a lot of conditional mutations,
this PR will speed up the parsing of the query.
cherry-pick of PR (#7871)
mangalaman93 added a commit that referenced this pull request Aug 16, 2023
If a mutation has a lot of conditional mutations, this PR will speed up
the parsing of the query. cherry-pick of PR (#7871)
jbhamra1 pushed a commit that referenced this pull request Aug 17, 2023
If a mutation has a lot of conditional mutations, this PR will speed up
the parsing of the query. cherry-pick of PR (#7871)
jbhamra1 pushed a commit that referenced this pull request Aug 17, 2023
If a mutation has a lot of conditional mutations, this PR will speed up
the parsing of the query. cherry-pick of PR (#7871)
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.

3 participants