envoyproxy / envoyproxy/envoy

router: performance improvement around route matching: remove per-route cost of repeative work on request path/headers.

Open
#21,615 12 comments 0 reactions 0 assignees View on GitHub
area/perf area/router enhancement no stalebot
Dominant language
C++
Stars
28.9k
Forks
5.6k
Avg merge
1d 20h
Merged PRs (30d)
437

Description

*Title*: performance improvement around route matching

*Description*:
Seems like some low hanging fruits for route matching performance improvement:

// In bool RouteEntryImplBase::matchRoute:

```
// we are initializing parsing QueryParams out of request path per route (if query parameters configured in the route):
if (!config_query_parameters_.empty()) {
Http::Utility::QueryParams query_parameters =
Http::Utility::parseQueryString(headers.getPathValue());
matches &= ConfigUtility::matchQueryParams(query_parameters, config_query_parameters_);
if (!matches) {
return false;
}
}

```

In PathMatcher::match(const absl::string_view path) there is a per-route cost of stripping the query/fragment from path:
I think there might be an issue for this already? We found this with a benchmark test.

```
bool PathMatcher::match(const absl::string_view path) const {
return matcher_.match(Http::PathUtil::removeQueryAndFragment(path));
}
```

[optional *Relevant Links*:]
>Any extra documentation required to understand the issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.