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 matcher-tree creation happening per filter instance #37797

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bsurber
Copy link
Contributor

@bsurber bsurber commented Dec 23, 2024

Commit Message: Move matcher-tree creation to config.cc so that it isn't recreated with every instance of the rate_limit_quota filter
Additional Description:
Risk Level:
Testing: Manual testing in-progress
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
Fixes #37534

Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #37797 was opened by bsurber.

see: more, trace.

…th every instance of the rate_limit_quota filter

Signed-off-by: Brian Surber <[email protected]>
@bsurber bsurber force-pushed the fix-matcher-build-rlqs branch from c622a7d to bb9a277 Compare December 24, 2024 01:19
@bsurber bsurber marked this pull request as ready for review December 24, 2024 02:11
Copy link
Member

@tyxia tyxia left a comment

Choose a reason for hiding this comment

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

LGTM, modulo some nits.

/wait

if (callbacks_ != nullptr) {
data_ptr_ = std::make_unique<Http::Matching::HttpMatchingDataImpl>(callbacks_->streamInfo());
} else {
if (!data_ptr_) {
Copy link
Member

Choose a reason for hiding this comment

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

i actually prefer data_ptr == nullptr style throughout this file. That is more readable for pointer type.

}

return [&, config = std::move(config), config_with_hash_key, tls_store,
matcher](Http::FilterChainFactoryCallbacks& callbacks) -> void {
Copy link
Member

@tyxia tyxia Dec 24, 2024

Choose a reason for hiding this comment

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

for the matcher shared pointer here, you only need to make copy (i.e., increase ref count once) once.

For example, in the RateLimitQuotaFilter constructor, it is passed by value which will achieve the need of copy above. Other places can just be move

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance becomes very bad when we use xds matcher in http_filters.
2 participants