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

fix: Pull Queries: Avoids inefficient KsqlConfig copy with overrides #7193

Merged

Conversation

AlanConfluent
Copy link
Member

Description

The call to sessionConfig.getConfig(true); copies fields of ksqlconfig in order to apply overrides. This is very inefficient, slowing pull query performance locally on my Mac from 10k qps for key lookups to 6k, a 40% reduction.

I had made this change recently with #7006 so that the interpreter override would be available for pull queries. It had this unfortunate effect. The solution is to avoid the large copy and check overrides deliberately. We already have a pattern for this in PullQueryConfigPlannerOptions.

Testing done

Ran unit tests

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@AlanConfluent AlanConfluent requested a review from a team as a code owner March 10, 2021 17:49
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

Good catch! Thanks Alan

// Do not set sessionConfig.getConfig to true! The copying is inefficient and slows down pull
// query performance significantly. Instead use PullPlannerOptions which check overrides
// deliberately.
final KsqlConfig ksqlConfig = sessionConfig.getConfig(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

yikes. i wonder if there's a way for us to return a "view" when we call getConfig(true) instead of copying. This has bitten us twice 😢

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think rather than copy, we should more or less do what we do in this PR. Don't copy, but just check the overrides first.

Copy link
Contributor

@guozhangwang guozhangwang left a comment

Choose a reason for hiding this comment

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

LGTM!

@AlanConfluent AlanConfluent merged commit b36a3ce into confluentinc:master Mar 10, 2021
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