Skip to content

http: add priority_load_shed extension filter for priority-based overload shedding#45039

Open
leosarra wants to merge 9 commits into
envoyproxy:mainfrom
leosarra:priority-overload
Open

http: add priority_load_shed extension filter for priority-based overload shedding#45039
leosarra wants to merge 9 commits into
envoyproxy:mainfrom
leosarra:priority-overload

Conversation

@leosarra
Copy link
Copy Markdown
Contributor

@leosarra leosarra commented May 12, 2026

Commit Message: http: add priority_load_shed filter for priority-based overload shedding
Additional Description:
Adds a new alpha HTTP filter, envoy.filters.http.priority_load_shed, that maps a configured request header value into buckets and checks corresponding overload manager load shed points.

The filter reads a configured request header and treats its first value as the request priority. The priority value must be a non-negative integer. For example, a deployment could use a header such as x-message-priority: 10 or 3gpp-Sbi-Message-Priority: 10, then configure integer ranges that classify priorities into different shedding policies.

The parsed priority is mapped into configured priority buckets. Each bucket defines a half-open integer range, [start, end), and references an overload manager load shed point. If the parsed priority value falls within one of the configured bucket ranges and that bucket’s load shed point is currently active, the filter rejects the request locally using Envoy’s existing overload response behavior:503 Service Unavailable with the envoy overloaded body.

Requests are allowed to continue when:

  • the configured priority header is missing and no strict missing-header rejection is enabled
  • the header value is invalid and no strict invalid-header rejection is enabled
  • the parsed priority does not match any configured bucket and no default load shed point is configured
  • the matched load shed point is inactive
  • the referenced load shed point cannot be resolved

The filter also supports an optional default load shed point. When configured, it is used as a fallback for requests with missing, invalid, or unmatched priority values, allowing users to apply a baseline overload policy to otherwise unclassified traffic.
Note that this filter is much more configurable than the original proposal I had in the linked issue (especially when it comes to default bucket and the rejections config) , this was done in order to make it more flexible to accommodate use-cases that are not exactly the one that was described originally.

Risk Level: Low since the feature is implemented by an independent opt-in filter
Testing: Added unit and integration tests
Docs Changes: Added dedicated doc for the filter
Release Notes: Added mention in the release notes
Platform Specific Features: not present
Fixes #Issue: Close #43552

@repokitteh-read-only
Copy link
Copy Markdown

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: #45039 was opened by leosarra.

see: more, trace.

@leosarra leosarra changed the title Priority overload http: add priority_load_shed filter for priority-based overload shedding May 12, 2026
@leosarra leosarra force-pushed the priority-overload branch 2 times, most recently from 188e40b to 122e61d Compare May 12, 2026 22:14
Comment thread CODEOWNERS
/*/extensions/filters/http/local_ratelimit @mattklein123 @wbpcode
/*/extensions/filters/common/local_ratelimit @mattklein123 @wbpcode
# Priority load shed
/*/extensions/filters/http/priority_load_shed @kbaichoo @botengyao
Copy link
Copy Markdown
Contributor Author

@leosarra leosarra May 12, 2026

Choose a reason for hiding this comment

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

not sure who to put here, I added the maintainers involved in the review of the original issue (@KBaichoo @botengyao) . Let me know if I need to change this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @leosarra, have you followed Envoy extension policy prior to implementing this extension?

@leosarra leosarra force-pushed the priority-overload branch 3 times, most recently from ff0faeb to 70f7e3c Compare May 13, 2026 18:46
@leosarra leosarra changed the title http: add priority_load_shed filter for priority-based overload shedding http: add priority_load_shed extension filter for priority-based overload shedding May 14, 2026
@leosarra leosarra force-pushed the priority-overload branch 6 times, most recently from 2084996 to 6f50d48 Compare May 15, 2026 22:47
reject_on_invalid_header_(config.reject_on_invalid_header()),
stats_(generateStats(stats_prefix, scope)) {
if (config.header_name().empty()) {
creation_status = absl::InvalidArgumentError("header_name must be non-empty");
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure if it makes sense to have a redundant validation in the code if the rules are already set in the proto. wdyt?

@leosarra leosarra marked this pull request as ready for review May 18, 2026 07:48
@repokitteh-read-only
Copy link
Copy Markdown

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @markdroth
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #45039 was ready_for_review by leosarra.

see: more, trace.

@leosarra
Copy link
Copy Markdown
Contributor Author

Failure in precheck looks unrelated to the changes, probably a flaky test

Comment thread api/envoy/extensions/filters/http/priority_load_shed/v3/priority_load_shed.proto Outdated
@leosarra leosarra force-pushed the priority-overload branch from d3663d7 to 6d3e244 Compare May 19, 2026 23:44
leosarra added 7 commits May 19, 2026 23:49
Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Change-Id: Ica10811d9194789f25368fb2b9972dad5045aadb

Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Change-Id: I66569a0d2ba12f482fdde4642dd06aa70e4e8661

Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Change-Id: I486cc4769aac0dca67ae4aa7b5e3b78f73ae76ae

Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
leosarra added 2 commits May 19, 2026 23:49
Change-Id: Ie58ef7f7d4e04c38550c4e0ea2088567e6656b36

Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
Change reject_on_missing_header and reject_on_invalid_header from bool
to google.protobuf.BoolValue so that individual data plane
implementations can decide their own defaults when the fields are unset.

Change-Id: I70c4231ea197b31acb56b0d5b875b4096af7a6c0
Signed-off-by: Leonardo Sarra <leonardosarra96@gmail.com>
@leosarra leosarra force-pushed the priority-overload branch from 6d3e244 to c14914d Compare May 19, 2026 23:49
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.

Request for SBI Message Priority Support in overload manager

3 participants