Skip to content

some performance results of envoy's different versions #19103

Open

Description

@wbpcode

I did some simple tests today and found that envoy's performance seems to be getting worse and worse. Although I know features should always come at some cost. But those costs seem to be too much.

And although I know that performance is not the first goal of Envoy. But with continuous enhancement of Envoy, the performance seems to degrade too quickly. Here are some simple results of single envoy worker:

Version QPS
v1.12.4 26921.48
v1.13.3 25182.18
v1.14.7 23732.31
v1.15.5 21010.66
v1.16.5 19116.81
v1.17.4 17804.78
v1.18.4 16953.67
v1.19.1 16046.59
v1.20.0 15949.65

I think we should at least prevent it from further deterioration, and at the same time find ways to optimize it.

Here is my config yaml:

static_resources:
  listeners:
    - address:
        socket_address:
          address: 0.0.0.0
          port_value: 9090
      filter_chains:
        - filters:
            - name: envoy.http_connection_manager
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
                codec_type: auto
                stat_prefix: ingress_http
                route_config:
                  name: local_route
                  virtual_hosts:
                    - name: host-one # prefix route
                      domains:
                        - "*"
                      routes:
                        - match:
                            prefix: "/"
                          route:
                            cluster: httpbin
                http_filters:
                  - name: envoy.router
                    typed_config:
                      "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
                      dynamic_stats: false
                      suppress_envoy_headers: true
  clusters:
    - name: httpbin
      connect_timeout: 5s
      type: strict_dns
      lb_policy: round_robin
      load_assignment:
        cluster_name: httpbin
        endpoints:
          - lb_endpoints:
              - endpoint:
                  address:
                    socket_address:
                      address: localhost
                      port_value: 8080

admin:
  access_log_path: "/dev/null"
  address:
    socket_address:
      address: 0.0.0.0
      port_value: 20000

Back-end: multi-processes Nginx that will return simple short string.

Client command: wrk -c 200 -t 2 -d 180s http://localhost:9090/

Activity

  1. added
    triage
    on Nov 25, 2021
  2. wbpcode commented on Nov 25, 2021

    @wbpcode
    MemberAuthor
  3. zhxie commented on Nov 25, 2021

    @zhxie
    Contributor

    Have you ever profiled Envoy with tools like perf, so that we can find some hotspots from the result?

  4. wbpcode commented on Nov 25, 2021

    @wbpcode
    MemberAuthor

    Have you ever profiled Envoy with tools like perf, so that we can find some hotspots from the result?

    I will do it this weekend. 😄

  5. added
    investigate
    and removed
    triage
    on Nov 25, 2021
  6. rojkov commented on Nov 25, 2021

    @rojkov
    Member

    This feels like a duplicate of #13412.

  7. wbpcode commented on Nov 25, 2021

    @wbpcode
    MemberAuthor

    This feels like a duplicate of #13412.

    Yep. Looks like the degrading never stops.

  8. wbpcode commented on Nov 26, 2021

    @wbpcode
    MemberAuthor

    There are no obvious hotspots from the flame graph, just a very uniform slowdown. More encapsulation and abstraction gradually reduces the performance of Envoy.

  9. jmarantz commented on Nov 26, 2021

    @jmarantz
    Contributor

    I'm not sure if I buy that incremental changes in encapsulation and abstraction are likely to cause that much slowdown. I glanced at one of the flame-graphs and it's hard to know what to improve there.

    It might help to capture some perf-graphs from an instrumented binary that can provide more detail on what's going on. The purely sampled view we get from these flame-graphs might (for example, as a guess) hide some effects of changes in the way we make the networking system calls. E.g. we spend a lot of time in the 1.20 flamegraph in the kernel. Are we making larger numbers of calls for smaller chunks of data, for any reason?

    It would be nice to get a controlled repro of this, using NIghthawk preferably, and then run envoy under callgrind or compiled with various perf tools, so we can see call-counts for various functions. Using this we could compare how we are structuring our system calls to the earlier version of Envoy.

  10. wbpcode commented on Nov 26, 2021

    @wbpcode
    MemberAuthor

    I'm not sure if I buy that incremental changes in encapsulation and abstraction are likely to cause that much slowdown. I glanced at one of the flame-graphs and it's hard to know what to improve there.

    It might help to capture some perf-graphs from an instrumented binary that can provide more detail on what's going on. The purely sampled view we get from these flame-graphs might (for example, as a guess) hide some effects of changes in the way we make the networking system calls. E.g. we spend a lot of time in the 1.20 flamegraph in the kernel. Are we making larger numbers of calls for smaller chunks of data, for any reason?

    It would be nice to get a controlled repro of this, using NIghthawk preferably, and then run envoy under callgrind or compiled with various perf tools, so we can see call-counts for various functions. Using this we could compare how we are structuring our system calls to the earlier version of Envoy.

    I will try to do more investigate.

  11. mattklein123 commented on Nov 26, 2021

    @mattklein123
    Member

    Related to @jmarantz comment, over time we have generally moved to secure by default configuration. This almost universally is at odds with "horse race" benchmarks. So we will need to very carefully tease apart any differences. The work is useful but it's a lot more complicated than just looking at flame graphs. I also agree with @jmarantz that trying to run a reproducer under something like cachegrind will be a lot more informative.

  12. jmarantz commented on Nov 26, 2021

    @jmarantz
    Contributor

    Just to point this out: Matt suggests cachegrind and I suggested callgrind: they are related and both very useful:

    • they both are generated using the valgrind infrastructure (--tool=callgrind vs --tool=cachegrind)
    • cachegrind has a lot more detail of the simulated processor cache effects of each line of code
    • callgrind has more detail about time spent and call-counts at a function-level
    • they both benefit from an OptDebug compilation. I use --compilation_mode=opt --cxxopt=-g --cxxopt=-ggdb3 but those options might be dated as I haven't been able to do much direct technical work lately
    • they both generate reports that can be visualized with kcachegrind
    • they both run much slower than real time and I wouldn't run production traffic through them. But it should be no problem for nighthawk or any other synthetic load tool
  13. 60 remaining items

  14. botengyao commented on Apr 2, 2025

    @botengyao
    Member

    Thanks @triplewy for noticing this config, agreed this should be limited for overload management, and this is also limited in our environment. I will update the doc to reflect it.

  15. kyessenov commented on Apr 15, 2025

    @kyessenov
    Contributor

    What's the theory behind multi-accept causing performance degradation? Is it because a worker does more work per event and a lot of that work is wasted (due to slow upstreams)? What's the kernel queue size (128?)?

  16. botengyao commented on Apr 15, 2025

    @botengyao
    Member

    I think the multi-accept could cause issues under high load, not the general performance degradation concern per versions in this issue. From an internal load test and observation, Envoy can accept >1000 connections per event from kernel, and that will use more CPU and memory at that time to let Envoy be unstable during traffic spike, e.g., overload manager cannot kick in, leading to OOMs, and so on.

  17. triplewy commented on Apr 15, 2025

    @triplewy

    @kyessenov Essentially Envoy gets stuck performing SSL calculations when it accepts all downstream connections at the same time. This prevents upstream requests from completing in a certain amount of time because the event loop is filled with SSL calls. Our event loop duration during influxes of https connections could sometimes get to 10-30s.

    In production without setting max downstream conns to accept, we saw behavior where an influx of downstream https connections would cause our fleet of proxies to essentially collapse where all success rate dropped to 0% for 5 minutes and then it restored since the clients left from their requests were being reset. But due to our client behavior, they would come back after another 10 minutes and we'd have this 100-0% success rate oscillation during peak times in some clusters.

  18. kyessenov commented on Apr 15, 2025

    @kyessenov
    Contributor

    @triplewy OK, that makes sense. So this is really about flow control with respect to CPU, and we want reasonable fairness between upstream and downstream work.

  19. johnlanni commented on Jul 1, 2025

    @johnlanni
    Contributor

    @kyessenov Essentially Envoy gets stuck performing SSL calculations when it accepts all downstream connections at the same time. This prevents upstream requests from completing in a certain amount of time because the event loop is filled with SSL calls. Our event loop duration during influxes of https connections could sometimes get to 10-30s.

    In production without setting max downstream conns to accept, we saw behavior where an influx of downstream https connections would cause our fleet of proxies to essentially collapse where all success rate dropped to 0% for 5 minutes and then it restored since the clients left from their requests were being reset. But due to our client behavior, they would come back after another 10 minutes and we'd have this 100-0% success rate oscillation during peak times in some clusters.

    But this should not cause Envoy to crash, right? I understand it crashed due to an OOM. The reason for the OOM, I guess, is that after accepting a large backlog of connections in one event loop, the data sent over the connections was not processed in time, leading to the TCP read buffer occupying too much memory.

  20. KBaichoo commented on Jul 1, 2025

    @KBaichoo
    Contributor

    The reason for the OOM, I guess, is that after accepting a large backlog of connections in one event loop, the data sent over the connections was not processed in time, leading to the TCP read buffer occupying too much memory.

    Might be due to what you have in your listener filter chain which gets allocated on connection acceptance. I would be surprised if the TCP read buffer should be that large given that the application had not yet even accepted the connection.

  21. johnlanni commented on Jul 1, 2025

    @johnlanni
    Contributor

    Might be due to what you have in your listener filter chain which gets allocated on connection acceptance. I would be surprised if the TCP read buffer should be that large given that the application had not yet even accepted the connection.

    Yes, resource allocation related to connections on the Envoy side can also lead to OOM. Additionally, my previous statement was not clear; I did not mean that the TCP read buffer for unaccepted connections is large. What I wanted to point out is that after accepting a large number of connections in an event loop, if the data from each connection cannot be read in time, it will cause the data sent by the client on the already accepted connections to accumulate. If each event loop only accepts one request, this problem would not occur, effectively throttling the data sent by the client(limited by the maximum size of the accept queue.).

  22. triplewy commented on Jul 1, 2025

    @triplewy

    @johnlanni But the tcp buffer memory is in the kernel right? That would not impact the application from OOMing. From my understanding the connections are already established from the kernel side. The application just accepts them and in this case, Envoy reads the TLS CHLO from the TCP buffer of each accepted connection and signs the SSL handshake. I think the creation of a bunch of listener filters at the same time causes the proxy to OOM.

    What we think would be an interesting problem would be to see if making max_conns_to_accept_per_socket_event could be less than 1. For example 0.5. In what case should that number be lower than 1? What would you need to measure to find the optimal conns to accept for socket event (event loop).

  23. johnlanni commented on Jul 1, 2025

    @johnlanni
    Contributor

    Oh, indeed, unless in scenarios like K8s containers, where it might be OOM killed by the kubelet.

  24. kimiyasharifi commented on Nov 28, 2025

    @kimiyasharifi

    @triplewy @kyessenov @botengyao We recently experienced a very similar failure pattern during a traffic spike, and I wanted to share additional data points that may help others. Even though we explicitly set:
    max_connections_to_accept_per_socket_event: 1
    we still observed envoy OOMing under heavy load. Context from our setup:

    Very high spike on a single authority
    Two response flags showed strong spikes:

    • NoHealthyUpstream
    • UpstreamOverflow

    What we observed:

    • During the spike, downstream request rate suddenly exceeded normal levels by a large margin (screenshots attached).
    • Despite limiting accept-per-event to 1, envoy still accumulated large numbers of downstream connections quickly enough to push memory usage past limits.
    • All envoy nodes eventually hit oom and were restarted by kubernetes.
    • Upstream request latency increased, leading to overload behavior → pending requests → retries → more memory pressure.
    • The collapse pattern matched what others described: success rate dropped to ~0% for a period, recovered slightly, then collapsed again.
    Image Image Image Image Image Image Image

    Our hypothesis so far:

    1. The connection acceptance throttling helped, but
    2. Per-connection memory allocations (listener filters, tls handshake buffers, upstream pending request state)
    3. Combined with slow upstream response times under load
    4. Still caused envoy to accumulate enough state to oom, even without multi-accept behavior.

    It seems that under extreme spikes, the accept throttling alone is not sufficient to prevent memory growth from pending upstream requests + connection-level allocations.

    We’re still analyzing memory profiles and would love any guidance on:

    • whether additional configuration (circuit breakers? overload manager thresholds? tcp buffer tuning?) is recommended in conjunction with max_connections_to_accept_per_socket_event
    • and whether there are known high-memory paths triggered during upstream overflow conditions.

    If useful, I can share additional metrics or narrower traces.

  25. botengyao commented on Dec 2, 2025

    @botengyao
    Member

    It seems this issue is originally on the general performance problem version by version, and the topic is diverged to overload management. And it is a really tricky system problem in general that some need to be tuned, @kimiyasharifi, some insights:

    • Do you config the overload manager and what is your config? Is the traffic mainly H/1 or H/2?

    • Consider enabling load shed points, envoy.load_shed_points.tcp_listener_accept for envoy.load_shed_points.http_connection_manager_decode_headers downstream connections and requests.

    • Consider enabling load shed points envoy.load_shed_points.connection_pool_new_connection to prevent more connections for upstream when the system is under pressure.

      pending requests → retries → more memory pressure

    • Enabling the cluster level maximum active retries sounds a reasonable config to enable if you see retry storm.

  26. KBaichoo commented on Dec 2, 2025

    @KBaichoo
    Contributor

    It seems this issue is originally on the general performance problem version by version, and the topic is diverged to overload management. And it is a really tricky system problem in general that some need to be tuned

    @kimiyasharifi do you mind raising either another issue or bringing this up in the community call: https://docs.google.com/document/d/1Yc4zkV-A_cC_R3C0u6D15WQAsRSxADs8p2l8UMMa4P4/edit?tab=t.0#heading=h.vgkvn1hr5uor to keep this thread on track with general performance?

    The community call might be higher bandwidth for getting some help

  27. kimiyasharifi commented on Feb 7, 2026

    @kimiyasharifi

    It seems this issue is originally on the general performance problem version by version, and the topic is diverged to overload management. And it is a really tricky system problem in general that some need to be tuned, @kimiyasharifi, some insights:

    Sorry for the delay. We haven’t enabled the overload manager in Contour, and most of our traffic is HTTP/2.

  28. moozechen commented on Jul 20, 2026

    @moozechen

    Really interesting data. We've been benchmarking Envoy as a gRPC-web proxy for streaming workloads and seeing similar patterns — the per-connection overhead dominates at low concurrency but Envoy scales linearly once past ~100 concurrent streams.

    One observation that might help: we found that enabling HTTP/2 priority hints (via gRPC metadata on the client side) significantly improves tail latency under mixed workloads (large file transfers + small RPCs sharing the same connection). Without priority, a single large response can add 50-200ms to concurrent small RPCs. With priority, the max tail latency impact drops to <20ms.

    Also curious if you've tested with gRPC bidirectional streaming specifically? We noticed a ~15% throughput hit vs unary/server-streaming under Envoy, which seems to be from the extra buffering in the H2 frame layer. Would love to see that added to the benchmark matrix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/perfhelp wantedinvestigate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions