I Measured the Bandwidth and Concurrent Connections per IP for ELB for Envoy

I Measured the Bandwidth and Concurrent Connections per IP for ELB for Envoy

Measuring Nginx HTTP delivery via Elastic Load Balancing (ELB) for Envoy on m9g.2xlarge gave about 12 Gbps per IP and 20,000 concurrent connections. An IP was added about 1 minute 15 seconds after load began.
2026.11.28

This page has been translated by machine translation. View original

Introduction

On November 25, 2026, Elastic Load Balancing (ELB) for Envoy became generally available.

https://aws.amazon.com/about-aws/whats-new/2026/11/elastic-load-balancing-for-envoy-generally-available/

ELB for Envoy is a load balancer that runs the open-source Envoy proxy. In this article, I measured the bandwidth and the number of concurrent connections per proxy IP, and how the number of IPs grows when load is applied.

Test Environment

  • Region: Tokyo (ap-northeast-1)
  • Measurement path: completed within a single AZ (client → proxy IP in the same AZ → origin)

ELB for Envoy

  • Envoy version (proxyVersion): 1.40
  • IPv4: internal
  • Subnets: 1a and 1c
  • Listeners: HTTP ports 80 and 81 (to the origin in 1a), port 82 (to the origin in 1c)
  • Cluster: STATIC
  • Other settings: default values

EC2 (Origin)

  • Instance type: m9g.2xlarge (8 vCPU, 32 GiB memory, arm64). Network bandwidth: baseline 4.25 Gbps, peak 17 Gbps
  • Count: 1 in 1a. 1 more in 1c for measurement
  • AMI: Amazon Linux 2023 (arm64)
  • Connection: with a public IP, operated via SSM
  • Web server: nginx 1.30.7 (/etc/nginx/nginx.conf was replaced with the content below)
  • Files served: 2 files. /10m.bin is 10,485,760 bytes (10MB) of /dev/urandom output, and /1k.txt is 1,024 bytes of a base64 string of random numbers. Both were placed in /srv/www and loaded into the page cache
Creating the origin's nginx.conf and served files

Creating the files (/srv/www):

mkdir -p /srv/www
head -c 10485760 /dev/urandom > /srv/www/10m.bin
head -c 768 /dev/urandom | base64 -w0 | head -c 1024 > /srv/www/1k.txt
cat /srv/www/10m.bin > /dev/null
chmod -R a+rX /srv/www

/etc/nginx/nginx.conf:

user nginx;
worker_processes auto;
pid /run/nginx.pid;
events { worker_connections 65535; use epoll; }
http {
  access_log off;
  sendfile on;
  tcp_nopush on;
  keepalive_timeout 75;
  keepalive_requests 1000000;
  server {
    listen 80 default_server;
    root /srv/www;
  }
}

EC2 (Client)

  • Instance type: m9g.2xlarge (same as the origin)
  • Count: 1 in 1a. 1 more in 1c for measurement
  • AMI: Amazon Linux 2023 (arm64)
  • Connection: with a public IP, operated via SSM
  • Load tool: wrk 4.2.0

Test Method

The proxy was created using the same procedure as in the previous article.

https://dev.classmethod.jp/articles/aws-elb-for-envoy-ga-create-proxy/

Creating the Proxy

Proxy creation command and configuration files

I placed create-proxy-input.json and config-tp.yaml in the current directory and ran the following command.

aws elb-proxy create-proxy --cli-input-json file://create-proxy-input.json --cli-binary-format raw-in-base64-out --configuration configurationFile=\{configurationBytes@=file://config-tp.yaml\} --output json

create-proxy-input.json

{
  "name": "elbproxy-tp",
  "type": "envoy",
  "proxyVersion": "1.40",
  "roleArn": "<role-arn>",
  "networkConfiguration": {
    "ipConfiguration": {
      "ipAddressingConfiguration": { "ipv4Addressability": "internal", "ipv6Addressability": "off" }
    },
    "vpcConfiguration": {
      "subnets": [ { "subnetId": "<subnet-1a-id>" }, { "subnetId": "<subnet-1c-id>" } ],
      "securityGroups": [ { "securityGroupId": "<proxy-sg-id>" } ]
    }
  }
}

config-tp.yaml

admin:
  address:
    socket_address:
      address: 127.0.0.1
      port_value: 9901
static_resources:
  listeners:
  - name: l80
    address: { socket_address: { address: 0.0.0.0, port_value: 80 } }
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: l80
          route_config:
            name: r80
            virtual_hosts:
            - name: all
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: origin_a }
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  - name: l81
    address: { socket_address: { address: 0.0.0.0, port_value: 81 } }
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: l81
          route_config:
            name: r81
            virtual_hosts:
            - name: all
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: origin_a }
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  - name: l82
    address: { socket_address: { address: 0.0.0.0, port_value: 82 } }
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: l82
          route_config:
            name: r82
            virtual_hosts:
            - name: all
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: origin_c }
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: origin_a
    type: STATIC
    connect_timeout: 5s
    load_assignment:
      cluster_name: origin_a
      endpoints:
      - lb_endpoints:
        - endpoint: { address: { socket_address: { address: <origin-a-ip>, port_value: 80 } } }
  - name: origin_c
    type: STATIC
    connect_timeout: 5s
    load_assignment:
      cluster_name: origin_c
      endpoints:
      - lb_endpoints:
        - endpoint: { address: { socket_address: { address: <origin-c-ip>, port_value: 80 } } }

Fixing and Observing IPs

The IPs that DNS returned right after creation (one each in 1a and 1c) are called the "original IPs." For the bandwidth and concurrent connection measurements, I connected by specifying the original IP in 1a.

Use dig to get the IPs that DNS returns.

dig +short A <プロキシの DNS 名>

Get the IP, status, and AZ of the ENIs that are not attached to an instance (the proxy's ENIs).

aws ec2 describe-network-interfaces --filters Name=vpc-id,Values=<vpc-id> --query 'NetworkInterfaces[?Attachment.InstanceId==null].join(`/`,[PrivateIpAddress,NetworkInterfaceId,Status,AvailabilityZone])' --output text

I ran these two commands every 10 seconds.

Measuring Bandwidth

Specifying the proxy IP in the same AZ as the client EC2, I ran wrk in the following form.

wrk -t<並列度と 4 の小さい方> -c<並列度> -d15s --timeout 30s --latency -s report.lua http://<IP>/10m.bin

Bandwidth (Gbps) is the number of received bytes counted by wrk (including headers) × 8 ÷ run time. The completion time is the p50 and p99 of the time taken to receive one 10MB file. Each measurement lasted 15 seconds, with a 5-second gap between measurements.

Because AWS/ProxyELB in CloudWatch has no bandwidth metric, I measured bandwidth with wrk on the client.

bench.sh and report.lua

bench.sh

#!/bin/bash
# usage: bench.sh <label> <url> <conns> [secs]   Client EC2 の /usr/local/bin/bench.sh
label=$1; url=$2; c=$3; d=${4:-15}
t=$(( c < 4 ? c : 4 ))
ulimit -n 1048576 2>/dev/null
echo "=== label=$label url=$url conns=$c threads=$t secs=$d start=$(date -u +%Y-%m-%dT%H:%M:%SZ)"
/usr/local/bin/wrk -t$t -c$c -d${d}s --timeout 30s --latency -s /usr/local/bin/report.lua "$url"
echo "=== end=$(date -u +%Y-%m-%dT%H:%M:%SZ) label=$label"

report.lua

done = function(summary, latency, requests)
  io.write(string.format("RESULT bytes=%d duration_us=%d requests=%d gbps=%.3f err_connect=%d err_read=%d err_write=%d err_status=%d err_timeout=%d p50_us=%d p90_us=%d p99_us=%d max_us=%d\n",
    summary.bytes, summary.duration, summary.requests, summary.bytes * 8 / (summary.duration / 1e6) / 1e9,
    summary.errors.connect, summary.errors.read, summary.errors.write, summary.errors.status, summary.errors.timeout,
    latency:percentile(50), latency:percentile(90), latency:percentile(99), latency.max))
end

Measuring Concurrent Connections

On each connection, I fetched the 1KB file once with a keep-alive GET, and after receiving the response I kept the connection idle.

Connections were opened half each to ports 80 and 81 of the original IP in 1a. The conditions were as follows.

  • Stages: 5,000, 10,000, 20,000, 30,000, 50,000. Each stage was held for 120 seconds
  • New connection rate: 100 connections every 0.1 seconds (1,000 connections/second or less)
  • Measurement during the hold: send a 1KB GET on a separate connection every 0.1 seconds to measure round-trip time, and 20 seconds before the end of the hold, fetch the 10MB file once with parallelism 1 on a separate connection
  • Stop conditions: failure of a new connection, disconnection of a held connection, a response other than 200, failure of a measurement GET. Also, when the p99 of new connection establishment time or the p99 of the 1KB GET round-trip time exceeded 3 times the value at the 5,000 stage
hold.py
#!/usr/bin/env python3
"""プロキシの 1 つの IP へ keep-alive の GET を 1 回送ってアイドルで保持し、段階的に接続数を増やす。
usage: hold.py <proxy-ip>
- 接続は IP の 80 番と 81 番へ交互に張る。各接続で、完結した keep-alive の GET(1KB)を 1 回送り、応答後はアイドルで保持する(HOLD_MODE=get。byte は先頭 1 バイトだけ、none は何も送らない)
- 新規接続の速度は 1,000 件/秒以下(0.1 秒ごとに 100 件)
- 各段階で 120 秒保持。保持中、別の接続で 1KB の GET を 0.1 秒ごとに送り、往復時間を記録する
- 各段階の保持の終了 20 秒前(既定 100 秒目)に、別の接続で 10MB の GET を 1 回行う(並列度 1)
- 停止条件: 新規接続の失敗 1 件 / 200 以外の応答 / 保持中の接続の切断 / 確立時間 p99 が最初の段階の 3 倍超 / 1KB GET の往復 p99 が最初の段階の 3 倍超 / プローブの失敗
"""
import asyncio, time, json, sys, resource, errno, math, os

IP = sys.argv[1]
PORTS = [80, 81]
STAGES = json.loads(os.environ.get('HOLD_STAGES', '[5000, 10000, 20000, 30000, 50000]'))
HOLD = int(os.environ.get('HOLD_SECS', '120'))
MODE = os.environ.get('HOLD_MODE', 'get')   # get | byte | none
REQ = b'GET /1k.txt HTTP/1.1\r\nHost: x\r\n\r\n'
BATCH = 100          # 0.1 秒あたりの新規接続数(= 1,000 件/秒)
CLIENT_SIDE = {errno.EMFILE, errno.ENFILE, errno.EADDRNOTAVAIL, errno.ENOBUFS, errno.ENOMEM}

soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (min(hard, 200000), hard))

LOG = open(os.environ.get('HOLD_LOG', '/var/tmp/hold.log'), 'a', buffering=1)
def log(**kw):
    kw = {'ts': time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()), **kw}
    LOG.write(json.dumps(kw) + '\n')

def pct(a, p):
    if not a:
        return None
    a = sorted(a)
    return round(a[max(0, math.ceil(p / 100 * len(a)) - 1)] * 1000, 2)  # ms

writers, watchers = [], []
dropped, fails, probe_fails, bad_status = [], [], [], []
stage_conn, probe_conn, probe_rtt = [], [], []
state = {'probing': True}

async def watch(reader, idx):
    try:
        first = True
        while True:
            d = await reader.read(65536)
            if d == b'':
                dropped.append(('eof', idx, time.strftime('%H:%M:%SZ', time.gmtime())))
                return
            if first and MODE == 'get':
                first = False
                if not d.startswith(b'HTTP/1.1 200'):
                    bad_status.append((d[:40].decode('latin1'), idx))
    except Exception as e:
        dropped.append((type(e).__name__, idx, time.strftime('%H:%M:%SZ', time.gmtime())))

def classify(e):
    if isinstance(e, asyncio.TimeoutError):
        return 'timeout', False
    if isinstance(e, OSError):
        return errno.errorcode.get(e.errno, str(e.errno)), e.errno in CLIENT_SIDE
    return type(e).__name__, False

async def open_one(port):
    t0 = time.monotonic()
    try:
        r, w = await asyncio.wait_for(asyncio.open_connection(IP, port), 5)
    except Exception as e:
        kind, client = classify(e)
        fails.append((kind, 'client' if client else 'server-or-network', port))
        return
    stage_conn.append(time.monotonic() - t0)
    if MODE == 'get':
        w.write(REQ)    # 完結した keep-alive の GET を 1 回送り、応答後はアイドルで保持する
    elif MODE == 'byte':
        w.write(b'G')   # リクエスト行の先頭 1 バイトだけ(リクエストは完結させない)
    writers.append(w)
    watchers.append(asyncio.create_task(watch(r, len(writers))))

async def http_get(path):
    t0 = time.monotonic()
    r, w = await asyncio.wait_for(asyncio.open_connection(IP, 80), 5)
    t1 = time.monotonic()
    w.write(f'GET {path} HTTP/1.1\r\nHost: x\r\nConnection: close\r\n\r\n'.encode())
    n = 0
    while True:
        d = await asyncio.wait_for(r.read(1 << 20), 30)
        if not d:
            break
        n += len(d)
    t2 = time.monotonic()
    w.close()
    return t1 - t0, t2 - t0, n

async def prober():
    while state['probing']:
        try:
            c, total, n = await http_get('/1k.txt')
            probe_conn.append(c); probe_rtt.append(total)
        except Exception as e:
            probe_fails.append(classify(e)[0])
        await asyncio.sleep(0.1)

async def main():
    log(event='start', ip=IP, ports=PORTS, stages=STAGES, hold_s=HOLD, nofile_soft=min(hard, 200000))
    probe_task = asyncio.create_task(prober())
    base = None
    prev = None
    for N in STAGES:
        stage_conn.clear(); probe_conn.clear(); probe_rtt.clear()
        t_start = time.monotonic()
        i = 0
        while len(writers) + len(fails) < N and not fails:
            b0 = time.monotonic()
            k = min(BATCH, N - len(writers))
            await asyncio.gather(*[open_one(PORTS[(len(writers) + j) % 2]) for j in range(k)])
            await asyncio.sleep(max(0, 0.1 - (time.monotonic() - b0)))
        ramp_s = time.monotonic() - t_start
        log(event='ramp_done', stage=N, established=len(writers), fails=len(fails), ramp_s=round(ramp_s, 1))
        big = None
        t_hold = time.monotonic()
        while time.monotonic() - t_hold < HOLD and not (fails or dropped or probe_fails or bad_status):
            await asyncio.sleep(1)
            if big is None and time.monotonic() - t_hold >= HOLD - 20:
                try:
                    c, total, n = await http_get('/10m.bin')
                    big = {'bytes': n, 'seconds': round(total, 4)}
                except Exception as e:
                    probe_fails.append('big:' + classify(e)[0])
        summ = dict(event='stage', stage=N, established=len(writers), fails=len(fails), fail_kinds=sorted(set(f[:2] for f in fails)),
                    dropped=len(dropped), probe_fails=len(probe_fails), bad_status=len(bad_status),
                    conn_ms_p50=pct(stage_conn, 50), conn_ms_p99=pct(stage_conn, 99), conn_n=len(stage_conn),
                    probe_conn_ms_p50=pct(probe_conn, 50), probe_conn_ms_p99=pct(probe_conn, 99),
                    probe_rtt_ms_p50=pct(probe_rtt, 50), probe_rtt_ms_p99=pct(probe_rtt, 99), probe_n=len(probe_rtt),
                    big_10mb=big)
        log(**summ)
        stop = None
        if fails:
            stop = 'connect-failure'
        elif bad_status:
            stop = 'bad-status'
        elif dropped:
            stop = 'held-connection-dropped'
        elif probe_fails:
            stop = 'probe-failure'
        elif base is None:
            base = {'conn': summ['conn_ms_p99'], 'rtt': summ['probe_rtt_ms_p99']}
            log(event='baseline', **base)
        else:
            if summ['conn_ms_p99'] and summ['conn_ms_p99'] > 3 * base['conn']:
                stop = 'connect-p99-over-3x'
            elif summ['probe_rtt_ms_p99'] and summ['probe_rtt_ms_p99'] > 3 * base['rtt']:
                stop = 'probe-rtt-p99-over-3x'
        if stop:
            log(event='stop', reason=stop, stage=N, previous=prev, fails=fails[:20], dropped=dropped[:20], bad_status=bad_status[:20], probe_fails=probe_fails[:20])
            break
        prev = summ
    state['probing'] = False
    await asyncio.sleep(0.5)
    log(event='release', closing=len(writers))
    for w in writers:
        w.close()
    await asyncio.sleep(2)
    log(event='done')

asyncio.run(main())

Measurement Results

Bandwidth Between EC2 Instances

I measured by connecting directly from the client in 1a to the origin in 1a without going through the proxy.

Parallelism Gbps (3 runs) 10MB completion time p50 (ms, 3 runs)
1 9.53, 9.53, 9.53 8.9, 8.9, 8.8
4 16.89, 16.88, 16.89 15.4, 15.2, 19.8
8 16.89, 16.89, 16.89 30.2, 30.3, 30.3
16 16.89, 16.89, 16.89 84.7, 64.9, 55.4

At parallelism 4 and above, it was constant at about 16.9 Gbps, close to the m9g.2xlarge peak of 17 Gbps. Parallelism 2 measured after the measurements through the proxy gave 16.89 and 16.83 Gbps, and parallelism 4 gave 16.84 and 16.89 Gbps, remaining at about 16.9 Gbps.

Bandwidth per Proxy IP

I connected by specifying the proxy's original IP in 1a and measured under the same conditions.

Parallelism Gbps (2 runs) 10MB completion time p50 (ms) p99 (ms)
1 4.96, 4.95 16.9, 16.9 17.1, 17.0
2 9.86, 9.86 16.9, 17.0 17.5, 17.7
4 12.17, 11.83 24.1, 22.9 221.0, 260.0
8 12.17, 12.22 46.4, 47.3 296.3, 277.8

Parallelism 1 was about half of the EC2-to-EC2 result. Parallelism 4 and 8 plateaued at about 12 Gbps, about 70% of the EC2-to-EC2 result (about 16.9 Gbps).

IP Increase and Bandwidth of the New IPs

In the records 20 to 40 seconds after the proxy became active, DNS returned 2 IPs in total, one each in 1a and 1c, and the proxy also managed 2 ENIs.

Time Event
02:43:04 Started creating the proxy
02:45:58 Confirmed active
02:46:35–02:52:02 2 ENIs. The only traffic through the proxy during this period was a 3-second operation check at 02:46:52
02:52:02 Started bandwidth measurement to the original IP in 1a (parallelism 1, 2, 4, 8, 2 rounds). No load was applied to the IP in 1c
02:53:17 A new ENI in 1c appears as available (during the parallelism 8 measurement of round 1). About 10 seconds later, in-use
02:53:38 A new ENI in 1a appears as available. About 10 seconds later, in-use
02:54:36 DNS returns 2 IPs each for 1a and 1c, 4 in total
From 03:09 Concurrent connection test. ENIs remained at 4 until 03:19

The original IPs remained in the DNS response after the increase.

I measured the new IP and the original IP alternately, 15 seconds each. For the 1c measurements, I used the EC2 in 1c and the listener on port 82.

AZ Parallelism New IP Gbps Original IP Gbps
1a 1 4.96 4.95
1a 8 12.03, 12.10 12.21, 12.20
1c 1 4.96 4.96
1c 8 12.01, 12.07 12.17, 12.08

The performance of the new IPs and the original IPs was about the same.

Concurrent Connections

After the IPs increased to 4, I held keep-alive idle connections on the original IP in 1a. During the hold, the ENIs remained at 4.

Connections Established Failed Disconnected New connection establishment time p50 (ms) New connection establishment time p99 (ms) Round trip p99 of 1KB GET on a separate connection (ms)
5,000 5,000 0 0 5.61 21.97 1.19
10,000 10,000 0 0 5.45 38.56 1.16
20,000 20,000 0 0 5.43 83.51 1.23

The establishment times in the table were measured on the client (hold.py). Because a slight delay appeared in the p99 of connection establishment at the 20,000 stage, I ended the measurement there.

The values measured on separate connections during the hold were about the same across the stages.

  • 1KB GET (new connection each time): p99 of connection establishment time was 0.34–0.36 ms
  • 10MB transfer (parallelism 1): 16.7, 17.1, 16.9 ms (16.9 ms when not holding connections)

Summary

In this measurement, I confirmed that a bandwidth of about 12 Gbps per IP is achievable and that more than 10,000 concurrent connections can be held.

About 1 minute 15 seconds after load began, the IPs increased from 1 to 2 per AZ. The bandwidth of the added IPs was about the same as the original IPs, so the total bandwidth of the proxy is calculated to have doubled.

Unlike ALB, ELB for Envoy has no API to reserve LCUs in advance. If a large spike in access is expected, carry out a load test that reproduces the spike beforehand, and identify the metrics that indicate the performance limit. If necessary, I recommend warming up by applying load before the spike.

Share this article

AWSのお困り事はクラスメソッドへ