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

Add envoy connection balancing. #14616

Merged
merged 13 commits into from
Sep 26, 2022
Merged

Add envoy connection balancing. #14616

merged 13 commits into from
Sep 26, 2022

Conversation

hashi-derek
Copy link
Member

@hashi-derek hashi-derek commented Sep 14, 2022

Description

This PR adds support for the Envoy exact_balance configuration option.

https://cloudnative.to/envoy/api-v3/config/listener/v3/listener.proto.html#config-listener-v3-listener-connectionbalanceconfig-exactbalance

Without this configuration, connections are randomly allocated to Envoy worker threads. Because connections never change threads in Envoy after creation, this can result in uneven distribution of workload. For long-lived, high-traffic connections, it is best to specify this option to guarantee that connection counts are maintained evenly between Envoy workers.

Testing & Reproduction steps

Unit tests were added. Manual testing was performed by using the following configuration and toggling the various permutations of the new fields, then inspecting the Envoy admin config_dump endpoint.

Kind = "service-defaults"
Name = "middle"

BalanceInboundConnections = "exact_balance"
UpstreamConfig {
  Defaults {
    BalanceOutboundConnections = "exact_balance"
  }
  Overrides = [
    {
      Name = "end"
      BalanceOutboundConnections = "exact_balance"
    }
  ]
}
service {
  name = "middle"
  port = 9001

  connect {
    sidecar_service {
      proxy {
        config {
          balance_inbound_connections = "exact_balance"
        }
        upstreams = [
          {
            destination_name = "end"
            local_bind_port  = 5000
            config {
              balance_outbound_connections = "exact_balance"
            }
          },
          {
            destination_name = "something"
            local_bind_port  = 5001
          }
        ]
      }
    }
  }
}

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

@github-actions github-actions bot added theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support labels Sep 14, 2022
@hashi-derek hashi-derek marked this pull request as ready for review September 16, 2022 16:03
@hashi-derek hashi-derek requested a review from a team as a code owner September 16, 2022 16:03
@hashi-derek hashi-derek requested review from a team, skpratt and erichaberkorn and removed request for a team September 16, 2022 17:48
Copy link
Contributor

@skpratt skpratt left a comment

Choose a reason for hiding this comment

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

Lgtm!

@hashi-derek hashi-derek changed the title Add envoy connection balancing to upstreams. Add envoy connection balancing. Sep 26, 2022
Copy link
Contributor

@erichaberkorn erichaberkorn left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@hashi-derek hashi-derek added the type/docs Documentation needs to be created/updated/clarified label Sep 26, 2022
Copy link
Contributor

@trujillo-adam trujillo-adam left a comment

Choose a reason for hiding this comment

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

Made a few suggestions on the docs.

website/content/docs/connect/proxies/envoy.mdx Outdated Show resolved Hide resolved
website/content/docs/connect/proxies/envoy.mdx Outdated Show resolved Hide resolved
website/content/docs/connect/proxies/envoy.mdx Outdated Show resolved Hide resolved
hashi-derek and others added 3 commits September 26, 2022 11:03
Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com>
Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com>
Co-authored-by: trujillo-adam <47586768+trujillo-adam@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/api Relating to the HTTP API interface theme/envoy/xds Related to Envoy support type/docs Documentation needs to be created/updated/clarified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants