diff --git a/.github/workflows/benchmark-pr.yml b/.github/workflows/benchmark-pr.yml index 8426c1047..5116d8d5a 100644 --- a/.github/workflows/benchmark-pr.yml +++ b/.github/workflows/benchmark-pr.yml @@ -443,6 +443,11 @@ jobs: if m3 and rows: rows[-1].update(cpureq=m3.group(1), p99=m3.group(2), p999=m3.group(3), ratio=m3.group(4)) + continue + # connections-ramp-h1: how far the ramp got, which is its result. + m4 = re.match(r"^=== Ramp: (.+) ===$", line) + if m4 and rows: + rows[-1]["ramp"] = m4.group(1) return rows def table(rows, deltas): @@ -474,6 +479,9 @@ jobs: out.append(base + mid + tail_) else: out.append(base + tail_) + for r in rows: + if r.get("ramp"): + out += ["", "{} / {}: {}".format(r["prof"], r["conns"], r["ramp"])] return "\n".join(out) def tail(path, n): diff --git a/frameworks/actix/meta.json b/frameworks/actix/meta.json index b6b2c6dde..37a85b708 100644 --- a/frameworks/actix/meta.json +++ b/frameworks/actix/meta.json @@ -22,6 +22,7 @@ "connections-5m", "connections-1m-tls", "connections-1m", + "connections-ramp-h1", "latency-10k", "pipelined", "limited-conn", diff --git a/frameworks/actix/src/main.rs b/frameworks/actix/src/main.rs index bebdc6370..b8cccb358 100644 --- a/frameworks/actix/src/main.rs +++ b/frameworks/actix/src/main.rs @@ -408,6 +408,10 @@ async fn main() -> io::Result<()> { // even the default cap of its 2-CPU box - so only the held-connection // profiles ever reach it. .max_connections(100_000) + // connections-ramp-h1 wants an idle connection kept for at least 30 seconds. + // actix's default is 5 s, timed on a clock that ticks every 500 ms, so 35 + // clears the 30 by more than that tick. + .keep_alive(std::time::Duration::from_secs(35)) .tcp_nodelay(true) .bind("0.0.0.0:8080")?; diff --git a/frameworks/aspnet-minimal/meta.json b/frameworks/aspnet-minimal/meta.json index 045888486..fccdc99ba 100644 --- a/frameworks/aspnet-minimal/meta.json +++ b/frameworks/aspnet-minimal/meta.json @@ -23,6 +23,7 @@ "connections-5m", "connections-1m-tls", "connections-1m", + "connections-ramp-h1", "json-comp", "json-tls", "8gbit", diff --git a/frameworks/bun/meta.json b/frameworks/bun/meta.json index 9d31cddc4..5d0dac868 100644 --- a/frameworks/bun/meta.json +++ b/frameworks/bun/meta.json @@ -21,6 +21,7 @@ "connections-5m", "connections-1m-tls", "connections-1m", + "connections-ramp-h1", "pipelined", "limited-conn", "json-comp", diff --git a/frameworks/fib/meta.json b/frameworks/fib/meta.json index 3be7ca8b7..e3ced6c20 100644 --- a/frameworks/fib/meta.json +++ b/frameworks/fib/meta.json @@ -23,6 +23,7 @@ "connections-5m", "connections-1m-tls", "connections-1m", + "connections-ramp-h1", "latency-10k", "json-comp", "json-tls", diff --git a/frameworks/genhttp-ioxide/Dockerfile b/frameworks/genhttp-ioxide/Dockerfile index 1c9d74362..7b73d2ef4 100644 --- a/frameworks/genhttp-ioxide/Dockerfile +++ b/frameworks/genhttp-ioxide/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/dotnet/sdk:11.0 AS build # GenHTTP built from source: the branch of Kaliumhexacyanoferrat/GenHTTP#953 # (update-ioxide-0.20.396) rather than the 11.3.0 release. Pinned to one commit, # because a build on cached layers would otherwise keep whichever it cloned first. -ARG GENHTTP_COMMIT=5967f5c6bf64d3d67a0eed7a669fa2f8c846dd02 +ARG GENHTTP_COMMIT=0229cfba8ac5d250d2151578e95ba646ee34de9c RUN git init -q /genhttp \ && git -C /genhttp fetch -q --depth 1 https://github.com/Kaliumhexacyanoferrat/GenHTTP.git "$GENHTTP_COMMIT" \ && git -C /genhttp checkout -q FETCH_HEAD diff --git a/frameworks/genhttp-ioxide/Program.cs b/frameworks/genhttp-ioxide/Program.cs index c399d7a55..b41d0c1ba 100644 --- a/frameworks/genhttp-ioxide/Program.cs +++ b/frameworks/genhttp-ioxide/Program.cs @@ -65,6 +65,11 @@ { WriteSlabSize = writeSlab ?? new TcpTransportOptions().WriteSlabSize, + // An idle connection is closed after 35 s, as is one whose client stops draining a flush + // for as long. Past the 30 s connections-ramp-h1 asks an idle connection to be kept for. + ReadTimeoutMs = 35_000, + SendTimeoutMs = 35_000, + // Kernel TLS on the way out, which is what this entry measured before the engine made it // opt-in: ioxide.tls used to default it on, so json-tls has always been kTLS TX with // OpenSSL still decrypting inbound. It needs the Linux tls module - without it every diff --git a/frameworks/genhttp-ioxide/genhttp.csproj b/frameworks/genhttp-ioxide/genhttp.csproj index fba764d37..36840888e 100644 --- a/frameworks/genhttp-ioxide/genhttp.csproj +++ b/frameworks/genhttp-ioxide/genhttp.csproj @@ -16,7 +16,7 @@ /genhttp @@ -33,9 +33,9 @@ - + - + diff --git a/frameworks/genhttp-ioxide/meta.json b/frameworks/genhttp-ioxide/meta.json index c1d8c6c4a..61c1c4d4d 100644 --- a/frameworks/genhttp-ioxide/meta.json +++ b/frameworks/genhttp-ioxide/meta.json @@ -22,6 +22,7 @@ "connections-5m", "connections-1m-tls", "connections-1m", + "connections-ramp-h1", "latency-10k", "pipelined", "limited-conn", diff --git a/frameworks/node/meta.json b/frameworks/node/meta.json index 2cf06923d..443773107 100644 --- a/frameworks/node/meta.json +++ b/frameworks/node/meta.json @@ -11,6 +11,7 @@ "connections-5m", "connections-1m-tls", "connections-1m", + "connections-ramp-h1", "pipelined", "limited-conn", "json-comp", diff --git a/frameworks/node/server.js b/frameworks/node/server.js index de58b40cb..e6dcd24d9 100644 --- a/frameworks/node/server.js +++ b/frameworks/node/server.js @@ -404,6 +404,10 @@ if (cluster.isPrimary) { const server = http.createServer(handle); + // connections-ramp-h1 wants an idle connection kept for at least 30 seconds; + // node closes it after 5 by default (plus the second of keepAliveTimeoutBuffer). + server.keepAliveTimeout = 35_000; + // Scaling is cluster to fork the workers, but not its round robin: with reusePort // every worker binds 8080 itself with SO_REUSEPORT and the kernel spreads the // accepts, the way bun and deno do it. node sets exclusive on its own when diff --git a/scripts/benchmark.sh b/scripts/benchmark.sh index 3ce4b91ce..f25a964fb 100755 --- a/scripts/benchmark.sh +++ b/scripts/benchmark.sh @@ -183,7 +183,7 @@ done # and any combination thereof. _has_isolated_test=false for t in baseline pipelined limited-conn json-comp json-tls upload \ - static-tls async-db async latency-1m latency-10k connections-5m connections-1m-tls connections-1m \ + static-tls async-db async latency-1m latency-10k connections-5m connections-1m-tls connections-1m connections-ramp-h1 \ baseline-h2 static-h2 baseline-h2c json-h2c \ baseline-h3 static-h3 \ unary-grpc unary-grpc-tls \ @@ -356,13 +356,16 @@ run_one() { # three runs, which is not known until all three have happened. Every run is # recorded here and the choice is made below. local _mdir="" - case "$endpoint" in latency-1m|latency-10k|8gbit|connections-5m|connections-1m-tls|connections-1m) _mdir=$(mktemp -d) ;; esac + case "$endpoint" in latency-1m|latency-10k|8gbit|connections-5m|connections-1m-tls|connections-1m|connections-ramp-h1) _mdir=$(mktemp -d) ;; esac BEST_M=() - local run + # connections-ramp-h1 is one ramp, after a warm-up at the offered rate + # (gcannon's --settle), and not a best-of. + local run runs="$RUNS" + [ "$endpoint" = "connections-ramp-h1" ] && runs=1 - for run in $(seq 1 "$RUNS"); do - echo ""; echo "[run $run/$RUNS]" + for run in $(seq 1 "$runs"); do + echo ""; echo "[run $run/$runs]" # The held-connection profiles give every run a fresh server. One that # has just held five million connections keeps what it grew to after @@ -487,7 +490,7 @@ run_one() { # fresh one. After the last run it is left for the profile's cleanup. if held_conn_profile "$endpoint" && ! $is_gateway; then held_conn_drain "after run $run" - if [ "$run" -lt "$RUNS" ]; then + if [ "$run" -lt "$runs" ]; then framework_stop fi elif [ "$CONNS" -ge 32768 ]; then sleep 15 @@ -584,8 +587,14 @@ run_one() { if [ -n "${BEST_M[hold_error]:-}" ]; then warn "$endpoint did not run: ${BEST_M[hold_error]}" else - echo "=== Connections: ${BEST_M[connections_open]:-n/a} open of $CONNS | connect errors in the window ${BEST_M[connect_errors]:-n/a} ===" - if [ -n "${BEST_M[connections_open]:-}" ] \ + if [ "$endpoint" = "connections-ramp-h1" ]; then + # Not a fleet that was held: how far the ramp got, and what + # stopped it (ceiling, p99 or rate; scripts/conn_hold.py). + echo "=== Ramp: reached ${BEST_M[ramp_reached]:-n/a} of $CONNS connections (${BEST_M[connections_open]:-n/a} open, ${BEST_M[idle_closed]:-n/a} idle closed by the server) | stopped by ${BEST_M[ramp_stop]:-n/a} ===" + else + echo "=== Connections: ${BEST_M[connections_open]:-n/a} open of $CONNS | connect errors in the window ${BEST_M[connect_errors]:-n/a} ===" + fi + if [ "$endpoint" != "connections-ramp-h1" ] && [ -n "${BEST_M[connections_open]:-}" ] \ && [ "${BEST_M[connections_open]}" -lt $(( CONNS * 99 / 100 )) ] 2>/dev/null; then warn "held ${BEST_M[connections_open]} of $CONNS connections through the window" fi @@ -703,6 +712,14 @@ save_result() { \"p50_latency\": \"${BEST_M[p50_lat]:-}\", \"connections_open\": ${BEST_M[connections_open]:-null}, \"window_connect_errors\": ${BEST_M[connect_errors]:-null}" + # connections-ramp-h1: the ramp's outcome (conn_hold.py + # ramp_summary), which the score is. + if [ "$profile" = "connections-ramp-h1" ]; then + eff_extra="$eff_extra, + \"ramp_reached\": ${BEST_M[ramp_reached]:-null}, + \"ramp_stop\": \"${BEST_M[ramp_stop]:-}\", + \"idle_closed\": ${BEST_M[idle_closed]:-null}" + fi fi fi diff --git a/scripts/conn_hold.py b/scripts/conn_hold.py index e0cdf5d43..a62d26eb1 100644 --- a/scripts/conn_hold.py +++ b/scripts/conn_hold.py @@ -2,7 +2,10 @@ """Run gcannon --rate for a held-connection profile; report a fixed-rate summary. connections-5m holds five million keep-alive connections and paces requests -across them, connections-1m-tls a million over TLS 1.3. gcannon does the load +across them, connections-1m-tls a million over TLS 1.3. connections-ramp-h1 +opens two million over two minutes instead, 95% of them idle, and this wrapper +reads from gcannon's interval timeline how many it took to push the active +ones' p99 over the limit (--ramp-p99-us). gcannon does the load itself (gcannon >= 0.8.2: --rate, --addr-span, --connect-limit, --settle, --warmup-max) in one process: ~3.3 KiB a connection, against the ~303 KiB that sank the first million-connection attempt with zrk 2.3.0. (connections-1m @@ -35,7 +38,7 @@ conn_hold.py --profile connections-5m --conns N --rate R --port P --probe 127.0.0.2,127.0.0.160 [--span 127.0.0.1-127.0.0.160] [--cpu-stat FILE] [--server-mem 128g] [--kib-per-conn 4] - [--kernel-kib-per-conn 8] + [--kernel-kib-per-conn 8] [--ramp-p99-us 2000] -- --args-- """ @@ -65,6 +68,22 @@ # server past its handshake timeout, which closed them mid-handshake: a fleet # that never finished connecting. MIN_VERSION_TLS = (0, 8, 4) +# connections-ramp-h1 is driven by --ramp-up and --idle, and read off the +# interval lines they print (gcannon#35). +MIN_VERSION_RAMP = (0, 10, 0) +# An interval's rate has to reach this share of what was offered, or the p99 +# next to it describes a server that is not keeping up (or one that has +# answered nothing at all, and has no p99). +RAMP_RATE_SHARE = 0.9 +# connections-ramp-h1: the least time an idle connection has to be left open, +# and how much earlier a close still passes - a server's timer may be coarse. +# validate-keepalive.py asks the same of a handful of connections; this asks it +# of the run, where a server under load might do otherwise. +IDLE_MIN_S = 30.0 +IDLE_SLACK_S = 1.0 +# Closes below this share of the idle connections opened are not looked at: a few +# resets are not a server shedding. +IDLE_CLOSED_SHARE = 0.01 def log(msg: str) -> None: @@ -174,6 +193,83 @@ def _raise_nofile(want: int) -> str | None: "fs.nr_open") +def idle_age(rows: list, i: int) -> float | None: + """How long the idle connections the server closed by the end of row i had + been open, in seconds: the time since the idle_closed(i)-th idle connection + was opened. A server that gives every connection the same time closes them + oldest first, so the n-th close is the n-th open and this is its timeout; one + that closes in another order comes out as the mean age. None while too few + were closed to say.""" + closed = rows[i].get("idle_closed") or 0 + opened = rows[i].get("idle_opened") or 0 + if opened <= 0 or closed < IDLE_CLOSED_SHARE * opened: + return None + now = rows[i].get("t") or 0.0 + t0, n0 = 0.0, 0 + for r in rows[:i + 1]: + t, n = r.get("t") or 0.0, r.get("idle_opened") or 0 + if n >= closed: + return now - (t0 + (t - t0) * (closed - n0) / (n - n0) if n > n0 else t) + t0, n0 = t, n + return None + + +def ramp_summary(args, g: dict) -> tuple[dict | None, str | None]: + """How far the ramp got before the active connections' p99 went over the + limit, from gcannon's timeline (one row per interval). Returns (summary, + None) or (None, why not). + + The row that counts is the last one before the limit is crossed. A crossing + is an interval over the limit - its p99, its rate short of what was offered, + which is also how a server that stopped answering reads, or idle connections + closed younger than IDLE_MIN_S - with the one after it over too, or with + nothing after it: one noisy interval on its own is not the end of a ramp. + `reached` is every connection opened by then, idle ones included, whether or + not the server has closed some since; `connections_open` is the most of them + that were open at once.""" + rows = g.get("timeline") or [] + if not rows: + return None, "no interval timeline in gcannon's summary" + + def over(i: int) -> str: + r = rows[i] + if (r.get("rps") or 0) < RAMP_RATE_SHARE * args.rate: + return "rate" + age = idle_age(rows, i) + if age is not None and age < args.idle_min_s - IDLE_SLACK_S: + return "shed" + if (r.get("p99_us") or 0) > args.ramp_p99_us: + return "p99" + return "" + + reached = open_now = idle_closed = 0 + stop, crossed = "ceiling", None + for i, r in enumerate(rows): + why = over(i) + if why and (i + 1 == len(rows) or over(i + 1)): + stop, crossed = why, i + break + if why: + continue # one interval on its own + # opened so far: the active connections open now, and every idle one + # ever opened (the timeline has no idle_* keys without --idle) + reached = (r.get("active") or 0) + (r.get("idle_opened") or 0) + open_now = max(open_now, (r.get("active") or 0) + (r.get("idle_open") or 0)) + idle_closed = r.get("idle_closed") or 0 + out = {"reached": reached, "connections_open": open_now, "stop": stop, + "idle_closed": idle_closed, "p99_limit_us": args.ramp_p99_us, + "intervals": len(rows)} + if crossed is not None: + r = rows[crossed] + out["stop_t"] = r.get("t") + out["stop_p99_us"] = r.get("p99_us") + out["stop_rps"] = r.get("rps") + age = idle_age(rows, crossed) + if age is not None: + out["stop_idle_age_s"] = round(age, 2) + return out, None + + def _error(args, msg: str) -> dict: log(msg) return {"hold_error": msg, "connections": args.conns, "target_rate": args.rate, @@ -185,10 +281,12 @@ def _error(args, msg: str) -> dict: def run(args, prefix: list[str], gargs: list[str]) -> dict: ver = _version(prefix) tls = bool(gargs) and gargs[0].startswith("https://") - need = MIN_VERSION_TLS if tls else MIN_VERSION + ramp = args.ramp_p99_us > 0 + need = MIN_VERSION_RAMP if ramp else MIN_VERSION_TLS if tls else MIN_VERSION if ver is None or ver < need: # prefix[-1] is the image or the binary: which gcannon was asked - why = ("--connect-limit held through the TLS handshake" if tls else + why = ("--ramp-up, --idle and the interval lines" if ramp else + "--connect-limit held through the TLS handshake" if tls else "--settle, and --rate with every thread spread over the whole interval") return _error(args, "%s needs gcannon >= %s (%s); %s %s" % (args.profile, ".".join(map(str, need)), why, prefix[-1], @@ -273,7 +371,7 @@ def watch_stderr(): and cpu.get("end") is not None and cpu["end"] >= cpu["start"] else None if g.get("connections_active") is not None: log(f"{g['connections_active']} of {args.conns} connections open at the end of the window") - return { + summary = { "connections": args.conns, "connections_open": g.get("connections_active"), "target_rate": args.rate, @@ -290,6 +388,25 @@ def watch_stderr(): "server_cpu_usec": cpu_win, "gcannon": g, } + if ramp: + found, why = ramp_summary(args, g) + if found is None: + return _error(args, why or "no ramp in gcannon's summary") + tail = "" + if found["stop"] != "ceiling": + tail = " at %.0f s (p99 %.2f ms, %.0f req/s" % ( + found.get("stop_t") or 0, (found.get("stop_p99_us") or 0) / 1000, + found.get("stop_rps") or 0) + if found["stop"] == "shed": + tail += ", idle connections closed after %.1f s, at least %.0f s is required" % ( + found.get("stop_idle_age_s") or 0, args.idle_min_s) + tail += ")" + log("reached %d connections (at most %d open at once) within %.1f ms p99; stopped by %s%s" + % (found["reached"], found["connections_open"], args.ramp_p99_us / 1000, + found["stop"], tail)) + summary["ramp"] = found + summary["connections_open"] = found["connections_open"] + return summary def main(argv: list[str]) -> int: @@ -312,6 +429,12 @@ def main(argv: list[str]) -> int: ap.add_argument("--profile", default="connections-5m", help="for messages") ap.add_argument("--span", default="127.0.0.1-127.0.0.160", help="the addresses the fleet is spread over, for messages") + ap.add_argument("--ramp-p99-us", dest="ramp_p99_us", type=int, default=0, + help="connections-ramp-h1: the p99 limit (microseconds) the ramp is " + "read against; 0 = not a ramp") + ap.add_argument("--idle-min-s", dest="idle_min_s", type=float, default=IDLE_MIN_S, + help="connections-ramp-h1: the least time (seconds) an idle connection " + "has to be left open before the server may close it") args = ap.parse_args(argv[:i]) print(json.dumps(run(args, argv[i + 1:j], argv[j + 1:]), indent=1)) return 0 diff --git a/scripts/gen_leaderboard_data.py b/scripts/gen_leaderboard_data.py index 6e8d416f9..f38397b64 100644 --- a/scripts/gen_leaderboard_data.py +++ b/scripts/gen_leaderboard_data.py @@ -81,6 +81,14 @@ # server may grow to 128 GiB, so the field is chosen rather than open. ("connections-5m", "CON-5M", "Score out of 100 (reference): CPU per request, memory, p50 and p99 latency with five million held connections at 1.25M req/s.", [5000000], [5000000], False,False,False), + # CON-RAMP: two million connections opened evenly over two minutes, + # 95% of them idle after one request, the other 5% carrying a fixed 100K + # req/s. The score is how many the ramp reached before those active + # ones' p99 went over 2 ms, as a share of the two million + # (latency_score.RAMP, conn_hold.py ramp_summary). Reference-only while + # the first field is measured. + ("connections-ramp-h1", "CON-RAMP", "Score out of 100 (reference): connections reached on a ramp to two million, 95% of them idle, before the active ones' p99 goes over 2 ms.", + [2000000], [2000000], False,False,False), ]), ("Efficiency", [ # Scored, on the same terms as latency-1m below: the rate is pinned, so @@ -167,7 +175,8 @@ # Efficiency-only. Emitted like TPL_FIELDS - only where present - so the # other ~2,300 rows in data.js do not each grow four nulls. EFF_FIELDS = ("cpu_usec", "cpu_per_req_us", "rate_ratio", "target_rate", - "p99_9_latency", "connections_open", "p50_latency") + "p99_9_latency", "connections_open", "p50_latency", + "ramp_reached", "idle_closed") # Map each benchmark profile to its Knowledge Base "Implementation Guidelines" # page (docs ids differ from profile ids; TLS gRPC variants share one page). @@ -185,6 +194,7 @@ "connections-1m": "test-profiles/h1/connections/implementation", "connections-1m-tls": "test-profiles/h1/connections/implementation", "connections-5m": "test-profiles/h1/connections/implementation", + "connections-ramp-h1": "test-profiles/h1/connections-ramp/implementation", # The database profiles rank on their own board but keep their docs under # h1/: those pages are linked from outside, so their URLs stay. "async-db": "test-profiles/h1/async-database/implementation", @@ -1286,7 +1296,8 @@ def lat_scores(pid): "p99": _lat.to_us(r.get("p99_latency")), "mean": _lat.to_us(r.get("avg_latency")), "p50": _lat.to_us(r.get("p50_latency")), - "mem": _lat.to_mib(r.get("memory"))} + "mem": _lat.to_mib(r.get("memory")), + "reached": r.get("ramp_reached") or 0} for key, rs in RESULTS.items() if key.startswith(pid + "-") and key[len(pid) + 1:].isdigit() for r in rs] diff --git a/scripts/latency_score.py b/scripts/latency_score.py index 04da0a7bc..43bd7e3be 100755 --- a/scripts/latency_score.py +++ b/scripts/latency_score.py @@ -3,7 +3,7 @@ the held-connection profiles `connections-1m`, `connections-1m-tls` and `connections-5m` (CON-1M, CON-1M-TLS, CON-5M). -Every other profile here ranks on one number, requests per second. This one +Every other profile here ranks on one number, requests per second. These cannot: the rate is pinned, so every entry that finishes serves the same load and the interesting differences are in what it cost and how the tail behaved. @@ -63,6 +63,20 @@ The rate factor still applies: a connection that never opened sends nothing, so a fleet only partly held shows up as a shortfall in the rate. +CON-RAMP (`connections-ramp-h1`) is not a steady load. Two million connections +open over two minutes, 95% of them idle, and the score is how far the ramp got +before the active connections' p99 went over the limit, as a share of the two +million: + + score = 100 * min(1, reached / FULL_RATE[profile]) + +`reached` is every connection opened by the last interval that held the limit +(conn_hold.py ramp_summary), idle ones included, whether or not the server has +closed some of them since: closing one is a server doing its job, once it has +kept it 30 seconds (a server that closes them younger ends its own ramp), and is +reported beside it. No ratio against the field's best: the limit is fixed and so +is the target. + Two modes: latency_score.py --pick [--profile P] best of N runs (benchmark.sh) @@ -96,6 +110,9 @@ # same way. "connections-1m-tls": 237_500.0, "connections-1m": 237_500.0, + # CON-RAMP is scored on the connections reached, not on a rate: full credit + # is the whole fleet. + "connections-ramp-h1": 2_000_000.0, } DEFAULT_PROFILE = "latency-1m" W_CPU, W_P99, W_MEAN = 0.50, 0.25, 0.25 @@ -109,6 +126,11 @@ H_CPU, H_MEM, H_P50, H_P99 = 0.25, 0.25, 0.25, 0.25 HELD_DECADES = 3.0 # p50 and p99: a third of the term per decade above the best +# connections-ramp-h1 (CON-RAMP): how many connections the ramp reached within the +# p99 limit, against the whole fleet. Keep in step with LAT_RAMP in +# site/leaderboard/index.html. +RAMP = frozenset({"connections-ramp-h1"}) + def to_us(value) -> float | None: """'173.0us' / '1.5ms' / '2s' -> microseconds. None when unparseable.""" @@ -161,7 +183,7 @@ def linear_score(value: float | None, best: float | None) -> float: def score_rows(rows: list[dict], profile: str = DEFAULT_PROFILE) -> list[dict]: """Annotate rows with their score. Each row needs rps, cpu, p99, mean - and - mem and p50 on the held-connection profiles. + mem and p50 on the held-connection profiles, and reached on CON-RAMP. Bests are taken over the rows given, so a caller scoring one framework's three runs gets them normalised against each other, and a caller scoring the @@ -171,6 +193,11 @@ def best_of(key): vals = [r[key] for r in rows if r.get(key)] return min(vals) if vals else None + if profile in RAMP: + for r in rows: + r["score"] = 100.0 * _clamp((r.get("reached") or 0) / FULL_RATE[profile]) + return rows + if profile in HELD: b_cpu, b_mem = best_of("cpu"), best_of("mem") b_p50, b_p99 = best_of("p50"), best_of("p99") @@ -235,6 +262,8 @@ def pick(dirpath: str, profile: str = DEFAULT_PROFILE) -> int | None: # the run's peak memory (benchmark.sh writes stats_mem per run). "p50": to_us(kv.get("p50_lat")), "mem": to_mib(meta.get("stats_mem")), + # CON-RAMP: how far the ramp got (conn_hold.py ramp_summary). + "reached": float(kv.get("ramp_reached") or 0), }) if not rows: return None @@ -262,12 +291,23 @@ def table(results_dir: Path, profile: str = DEFAULT_PROFILE) -> None: "mean": to_us(r.get("avg_latency")), "p50": to_us(r.get("p50_latency")), "mem": to_mib(r.get("memory")), + "reached": r.get("ramp_reached") or 0, }) if not rows: print(f"no {profile} results found", file=sys.stderr) return score_rows(rows, profile) rows.sort(key=lambda r: -r["score"]) + if profile in RAMP: + print("%-24s %7s %11s %9s %11s %11s" % + ("framework", "score", "reached", "us/req", "mem MiB", "p99")) + for r in rows: + print("%-24s %7.1f %11d %9s %11s %11s" % ( + r["fw"], r["score"], r["reached"], + "-" if r["cpu"] is None else f"{r['cpu']:.1f}", + "-" if r["mem"] is None else f"{r['mem']:.0f}", + "-" if r["p99"] is None else f"{r['p99']:.0f}")) + return if profile in HELD: print("%-24s %7s %7s %9s %10s %11s %11s" % ("framework", "score", "rate", "us/req", "mem MiB", "p50", "p99")) diff --git a/scripts/lib/common.sh b/scripts/lib/common.sh index 4808750d0..241836554 100644 --- a/scripts/lib/common.sh +++ b/scripts/lib/common.sh @@ -86,10 +86,11 @@ ulimit -n "$HARD_NOFILE" 2>/dev/null || true # The 5M caps are what the 251 GiB bench host has left after the fleet itself: # ~4 KiB of gcannon and ~8 KiB of kernel (both sockets and a conntrack entry) # per connection is ~57 GiB at five million; a server spending ~25 KiB per -# connection fits in 128g. The million-connection profiles (connections-1m-tls, -# connections-1m) get the 1M caps. Over TLS the kernel adds ~4 KiB of TLS -# state per socket on each side that uses it, so the fleet costs ~20 KiB a -# connection, ~19 GiB at a million, besides the server. +# connection fits in 128g. connections-ramp-h1, two million mostly idle +# connections, gets those caps too; the million-connection profiles +# (connections-1m-tls, connections-1m) get the 1M caps. Over TLS the kernel +# adds ~4 KiB of TLS state per socket on each side that uses it, so the fleet +# costs ~20 KiB a connection, ~19 GiB at a million, besides the server. CONN1M_NOFILE="${CONN1M_NOFILE:-2097152}" CONN1M_MEM_LIMIT="${CONN1M_MEM_LIMIT:-96g}" CONN5M_NOFILE="${CONN5M_NOFILE:-8388608}" @@ -107,7 +108,7 @@ HELD_CONN_DRAIN_TIMEOUT="${HELD_CONN_DRAIN_TIMEOUT:-600}" # " " for a held-connection profile's server container. held_conn_limits() { case "$1" in - connections-5m) echo "$CONN5M_NOFILE $CONN5M_MEM_LIMIT" ;; + connections-5m|connections-ramp-h1) echo "$CONN5M_NOFILE $CONN5M_MEM_LIMIT" ;; *) echo "$CONN1M_NOFILE $CONN1M_MEM_LIMIT" ;; esac } diff --git a/scripts/lib/profiles.sh b/scripts/lib/profiles.sh index 0f9ae70dc..47d96fe67 100644 --- a/scripts/lib/profiles.sh +++ b/scripts/lib/profiles.sh @@ -115,6 +115,20 @@ declare -A PROFILES=( # (scripts/zrk_fanout.py) and merges their histograms. It stays at a # million: zrk's ~41 KiB per connection rules out five. [connections-1m]="1|0|0-31,64-95|1000000|connections-1m" + # CON-RAMP: two million connections opened evenly over two minutes, 95% of + # them idle - one request each, then never used again - while the other 5% + # (100,000 active ones, the first 4,096 opened before the ramp starts) carry + # 100K req/s throughout. The question is how many of the fleet's connections + # the server takes before the active ones' p99 goes over 2 ms. A server may + # close an idle one after it has kept it 30 seconds (validate-keepalive.py + # checks a handful, conn_hold.py the run), and what it closed is counted; + # gcannon opens the fleet (--ramp-up, --idle) and reports one line per + # interval; the p99 limit and the 30 seconds are the harness's own + # (scripts/conn_hold.py, latency_score.RAMP). Needs + # gcannon >= 0.10.0. Same density per address as the other held profiles + # (31,250, over 127.0.0.1-.64). Opt-in and reference-only while the first + # field is measured. + [connections-ramp-h1]="1|0|0-31,64-95|2000000|connections-ramp-h1" [json-comp]="1|0|0-31,64-95|4096,16384|json-compressed" [json-tls]="1|0|0-31,64-95|4096|json-tls" # 8Gbit: 100 KB up and the same 100 KB back, over TLS. The only profile @@ -174,14 +188,16 @@ PROFILE_ORDER=( connections-5m connections-1m-tls connections-1m + connections-ramp-h1 ) # The held-connection profiles. Everything the harness does around their load # (host limits, the server's fd and memory caps, the window CPU, the held -# count) is the same for all three; only the generator and the scale differ. +# count) is the same for all of them; only the generator, the scale and - for +# connections-ramp-h1 - the shape of the load differ. held_conn_profile() { case "$1" in - connections-5m|connections-1m-tls|connections-1m) return 0 ;; + connections-5m|connections-1m-tls|connections-1m|connections-ramp-h1) return 0 ;; esac return 1 } diff --git a/scripts/lib/spec.sh b/scripts/lib/spec.sh index 448761499..31d82912a 100644 --- a/scripts/lib/spec.sh +++ b/scripts/lib/spec.sh @@ -14,7 +14,7 @@ SPEC_SUITES="" # listener, ws the /ws echo. spec_profiles_for() { case "$1" in - h1) echo "baseline pipelined limited-conn json-comp async async-db fortunes latency-1m latency-10k connections-1m connections-1m-tls connections-5m" ;; + h1) echo "baseline pipelined limited-conn json-comp async async-db fortunes latency-1m latency-10k connections-1m connections-1m-tls connections-5m connections-ramp-h1" ;; h2) echo "baseline-h2 static-h2 baseline-h2c json-h2c" ;; h3) echo "baseline-h3 static-h3" ;; ws) echo "echo-ws echo-ws-pipeline echo-ws-limited" ;; diff --git a/scripts/lib/tools/gcannon.sh b/scripts/lib/tools/gcannon.sh index 4cfefd8d0..c6267a1ce 100644 --- a/scripts/lib/tools/gcannon.sh +++ b/scripts/lib/tools/gcannon.sh @@ -38,6 +38,33 @@ GCANNON_RATE_CONNECTIONS_1M_TLS="${GCANNON_RATE_CONNECTIONS_1M_TLS:-250000}" CONN1M_TLS_ADDRS="${CONN1M_TLS_ADDRS:-32}" CONN1M_TLS_WARMUP_MAX="${CONN1M_TLS_WARMUP_MAX:-900}" +# connections-ramp-h1: a fleet that grows to 2M over two minutes, 95% of it +# idle. CONNRAMP_FLOOR active connections open in the warmup and carry the offered +# rate for CONNRAMP_SETTLE seconds, which warms the server up (JIT, caches, heaps) +# before anything counts: there is one run of it, not a best-of (benchmark.sh). +# Over CONNRAMP_UP seconds the rest of the active ones and all of the idle ones +# then open evenly, +# inside the measured window (CONNRAMP_WINDOW: the ramp, plus ten seconds that +# show the fleet standing). The active ones carry GCANNON_RATE_CONNECTIONS_RAMP +# throughout, paced by thread so the total does not depend on how many are +# open. The idle ones send one request and are never used or reopened, so a +# server that times them out shows it (gcannon >= 0.10.0: --ramp-up, --idle). +# The p99 limit is not gcannon's: conn_hold.py finds where the interval lines +# cross CONNRAMP_P99_US and reports how many connections it took to get there. A +# server that closes idle ones before they have been open CONNRAMP_IDLE_MIN +# seconds (less a second for coarse timers) ends the ramp the same way. +GCANNON_RATE_CONNECTIONS_RAMP="${GCANNON_RATE_CONNECTIONS_RAMP:-100000}" +CONNRAMP_FLOOR="${CONNRAMP_FLOOR:-4096}" +CONNRAMP_UP="${CONNRAMP_UP:-120}" +CONNRAMP_WINDOW="${CONNRAMP_WINDOW:-130}" +CONNRAMP_IDLE="${CONNRAMP_IDLE:-95%}" +CONNRAMP_ADDRS="${CONNRAMP_ADDRS:-64}" +CONNRAMP_P99_US="${CONNRAMP_P99_US:-2000}" +CONNRAMP_IDLE_MIN="${CONNRAMP_IDLE_MIN:-30}" +CONNRAMP_CONNECT_LIMIT="${CONNRAMP_CONNECT_LIMIT:-64}" +CONNRAMP_WARMUP_MAX="${CONNRAMP_WARMUP_MAX:-60}" +CONNRAMP_SETTLE="${CONNRAMP_SETTLE:-30}" + # ── Build arguments ───────────────────────────────────────────────────────── # Usage: gcannon_build_args [req_per_conn] @@ -136,6 +163,20 @@ gcannon_build_args() { --connect-limit "$CONN5M_CONNECT_LIMIT" --warmup-max "${warm}s" --settle "${CONN5M_SETTLE}s" --json) ;; + connections-ramp-h1) + # The same request as the other held profiles, and the same wrapper; + # what differs is how the fleet comes up and what is read from the + # result. + args=(--hold-- "$endpoint" "$conns" "$GCANNON_RATE_CONNECTIONS_RAMP" "$PORT" + "$CONNRAMP_WARMUP_MAX" "$CONNRAMP_ADDRS" + --args-- "http://127.0.0.1:$PORT/baseline11?a=1&b=2" + -c "$conns" -t "$THREADS" -d "${CONNRAMP_WINDOW}s" + --rate "$GCANNON_RATE_CONNECTIONS_RAMP" --idle "$CONNRAMP_IDLE" + --ramp "$CONNRAMP_FLOOR" --ramp-up "${CONNRAMP_UP}s" + --addr-span "$CONNRAMP_ADDRS" + --connect-limit "$CONNRAMP_CONNECT_LIMIT" + --warmup-max "${CONNRAMP_WARMUP_MAX}s" --settle "${CONNRAMP_SETTLE}s" --json) + ;; *) fail "gcannon_build_args: unknown endpoint '$endpoint'" ;; @@ -167,11 +208,12 @@ gcannon_run() { fi } -# connections-5m / connections-1m-tls: gcannon under scripts/conn_hold.py, -# which probes the listener, refuses a run the host cannot hold, raises the -# open-file limit for the fleet, and reads the server cgroup's CPU at -# gcannon's window markers. stdout is the wrapper's JSON summary; stderr -# (gcannon's own lines) goes straight to the log. +# connections-5m / connections-1m-tls / connections-ramp-h1: gcannon under +# scripts/conn_hold.py, which probes the listener, refuses a run the host cannot +# hold, raises the open-file limit for the fleet, and reads the server cgroup's +# CPU at gcannon's window markers. stdout is the wrapper's JSON summary; stderr +# (gcannon's own lines, the interval lines of a ramp included) goes straight to +# the log. _gcannon_hold_run() { local profile="$1" conns="$2" rate="$3" hport="$4" warm="$5" addrs="$6" shift 6 @@ -194,13 +236,18 @@ _gcannon_hold_run() { # Kernel memory per connection: both sockets and a conntrack entry, and # over TLS a kernel TLS context on each side that uses one (gcannon's # always, the server's when it offloads too). - local kernel_kib=8 + local kernel_kib=8 window=20 + local -a extra=() [ "$profile" = "connections-1m-tls" ] && kernel_kib=16 - timeout $(( warm + CONN5M_SETTLE + 20 + 300 )) python3 "$SCRIPT_DIR/conn_hold.py" \ + if [ "$profile" = "connections-ramp-h1" ]; then + window="$CONNRAMP_WINDOW" + extra=(--ramp-p99-us "$CONNRAMP_P99_US" --idle-min-s "$CONNRAMP_IDLE_MIN") + fi + timeout $(( warm + CONN5M_SETTLE + window + 300 )) python3 "$SCRIPT_DIR/conn_hold.py" \ --profile "$profile" --conns "$conns" --rate "$rate" --port "$hport" \ --probe "127.0.0.2,127.0.0.$addrs" --span "127.0.0.1-127.0.0.$addrs" \ ${cpu_stat:+--cpu-stat "$cpu_stat"} --server-mem "${FRAMEWORK_MEM_LIMIT:-$mem}" \ - --kib-per-conn 4 --kernel-kib-per-conn "$kernel_kib" \ + --kib-per-conn 4 --kernel-kib-per-conn "$kernel_kib" "${extra[@]}" \ -- "${prefix[@]}" --args-- "$@" || true } @@ -237,6 +284,13 @@ print("target_rate=%d" % (d.get("target_rate") or 0)) print("max_schedule_lag_us=%d" % (d.get("max_schedule_lag_us") or 0)) if d.get("connections_open") is not None: print("connections_open=%d" % d["connections_open"]) +# connections-ramp-h1: how far the ramp got before the active connections' p99 +# went over the limit, and why it ended there (conn_hold.py ramp_summary). +ramp = d.get("ramp") +if ramp: + print("ramp_reached=%d" % (ramp.get("reached") or 0)) + print("ramp_stop=%s" % (ramp.get("stop") or "")) + print("idle_closed=%d" % (ramp.get("idle_closed") or 0)) print("connect_errors=%d" % ((d.get("errors") or {}).get("connect") or 0)) if d.get("server_cpu_usec") is not None: print("cpu_usec_window=%d" % d["server_cpu_usec"]) @@ -251,7 +305,7 @@ gcannon_parse() { local endpoint="$1" output="$2" case "$endpoint" in - connections-5m|connections-1m-tls) + connections-5m|connections-1m-tls|connections-ramp-h1) _gcannon_hold_parse "$output" return 0 ;; diff --git a/scripts/tests/test_conn_ramp.py b/scripts/tests/test_conn_ramp.py new file mode 100644 index 000000000..bf1c24464 --- /dev/null +++ b/scripts/tests/test_conn_ramp.py @@ -0,0 +1,212 @@ +"""The connections-ramp-h1 reading of a gcannon run: how far the ramp got before +the active connections' p99 went over the limit, and what the score makes of it.""" + +from pathlib import Path +import sys +import tempfile +import types +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(ROOT / "scripts")) + +import conn_hold # noqa: E402 +import latency_score # noqa: E402 + + +ARGS = types.SimpleNamespace(rate=100_000, ramp_p99_us=2_000, idle_min_s=30.0) +# Nothing closed: the idle timeout is tested on its own below. +GOOD = (800, 100_000, 5_000, 100_000, 100_000, 0) +OVER = (9_000, 100_000, 5_000, 200_000, 200_000, 0) +SILENT = (0, 0, 5_000, 150_000, 150_000, 0) + +# The profile's own ramp: 1.9M idle connections opened evenly over 120 s. +IDLE, RAMP_S = 1_900_000, 120.0 + + +def opened(t): + return int(min(max(t, 0.0), RAMP_S) / RAMP_S * IDLE) + + +def ramp(closes, p99=800, rps=100_000, seconds=130): + """A run of the profile, one row every five seconds. closes(t) says how many + idle connections the server had closed by t.""" + rows = [] + for t in range(5, seconds + 1, 5): + o, c = opened(t), closes(t) + rows.append(dict(t=float(t), p99_us=p99, rps=rps, + active=int(4_096 + 95_904 * min(t, RAMP_S) / RAMP_S), + idle_opened=o, idle_open=o - c, idle_closed=c)) + return rows + + +def after(timeout): + """A server that closes each idle connection `timeout` seconds after it opened.""" + return lambda t: opened(t - timeout) + + +def read(rows): + found, why = conn_hold.ramp_summary(ARGS, {"timeline": rows}) + assert found is not None, why + return found + + +def summary(*spec): + """spec: (p99_us, rps, active, idle_opened, idle_open, idle_closed) per interval.""" + rows = [dict(t=5.0 * (i + 1), p99_us=p, rps=r, active=a, idle_opened=o, + idle_open=n, idle_closed=c) + for i, (p, r, a, o, n, c) in enumerate(spec)] + found, why = conn_hold.ramp_summary(ARGS, {"timeline": rows}) + assert found is not None, why + return found + + +class RampSummaryTests(unittest.TestCase): + def test_a_ramp_that_held_the_limit_reaches_its_ceiling(self): + got = summary(GOOD, GOOD, GOOD) + self.assertEqual((got["reached"], got["stop"]), (105_000, "ceiling")) + + def test_two_intervals_over_stop_it_at_the_last_one_that_held(self): + got = summary(GOOD, OVER, OVER, OVER) + self.assertEqual((got["reached"], got["connections_open"], got["stop"]), + (105_000, 105_000, "p99")) + self.assertEqual(got["stop_t"], 10.0) + + def test_one_interval_over_on_its_own_is_noise(self): + self.assertEqual(summary(GOOD, OVER, GOOD, GOOD)["stop"], "ceiling") + + def test_an_interval_over_at_the_end_still_counts(self): + got = summary(GOOD, GOOD, OVER) + self.assertEqual((got["reached"], got["stop"]), (105_000, "p99")) + + def test_a_server_that_stops_answering_is_a_rate_failure(self): + got = summary(GOOD, SILENT, SILENT) + self.assertEqual((got["reached"], got["stop"]), (105_000, "rate")) + + def test_nothing_is_reached_when_the_first_interval_is_over(self): + got = summary(OVER, OVER) + self.assertEqual((got["reached"], got["connections_open"]), (0, 0)) + + def test_reached_counts_what_was_opened_and_open_the_most_at_once(self): + got = read(ramp(after(40))) + self.assertEqual(got["reached"], 100_000 + IDLE) + # the peak is when the last connection opens: 100K active and the idle + # ones of the last 40 s + self.assertEqual(got["connections_open"], 100_000 + opened(120) - opened(80)) + self.assertEqual(got["idle_closed"], opened(130 - 40)) + # what is open at the end of the run is less, and is not what is kept + self.assertGreater(got["connections_open"], 100_000 + IDLE - opened(130 - 40)) + + def test_no_timeline_is_an_error_not_a_zero(self): + found, why = conn_hold.ramp_summary(ARGS, {}) + self.assertIsNone(found) + self.assertIn("timeline", why) + + +class IdleTimeoutTests(unittest.TestCase): + def test_a_server_that_never_closes_is_not_affected(self): + got = read(ramp(lambda t: 0)) + self.assertEqual((got["stop"], got["reached"]), ("ceiling", 2_000_000)) + + def test_a_five_second_timeout_ends_the_ramp_at_once(self): + # what actix did before its timeout was raised + got = read(ramp(after(4.6))) + self.assertEqual((got["stop"], got["reached"], got["connections_open"]), + ("shed", 0, 0)) + self.assertEqual(got["stop_t"], 5.0) + self.assertAlmostEqual(got["stop_idle_age_s"], 4.6, places=1) + + def test_the_first_lines_of_a_real_five_second_run(self): + opened_, closed = [79_160, 158_340, 237_500], [6_250, 85_420, 164_580] + rows = [dict(t=5.0 * (i + 1), p99_us=120, rps=100_000, active=8_000, + idle_opened=o, idle_open=o - c, idle_closed=c) + for i, (o, c) in enumerate(zip(opened_, closed))] + got = read(rows) + self.assertEqual((got["stop"], got["reached"]), ("shed", 0)) + self.assertAlmostEqual(got["stop_idle_age_s"], 4.6, places=1) + + def test_a_twenty_second_timeout_scores_what_opened_before_its_first_closes(self): + got = read(ramp(after(20))) + self.assertEqual((got["stop"], got["stop_t"]), ("shed", 25.0)) + self.assertEqual(got["reached"], 20_080 + opened(20)) # the t = 20 row + + def test_thirty_seconds_is_enough(self): + got = read(ramp(after(30))) + self.assertEqual((got["stop"], got["reached"]), ("ceiling", 2_000_000)) + + def test_a_coarse_clock_may_close_up_to_a_second_early(self): + self.assertEqual(read(ramp(after(29.1)))["stop"], "ceiling") + self.assertEqual(read(ramp(after(28.5)))["stop"], "shed") + + def test_the_rule_is_the_one_asked_for(self): + rows = ramp(after(12)) + self.assertEqual(read(rows)["stop"], "shed") + found, _ = conn_hold.ramp_summary( + types.SimpleNamespace(rate=100_000, ramp_p99_us=2_000, idle_min_s=10.0), + {"timeline": rows}) + self.assertEqual(found["stop"], "ceiling") + + def test_a_few_resets_are_not_shedding(self): + # under 1% of what was opened: 500 resets in the first five seconds + self.assertEqual(read(ramp(lambda t: 500))["stop"], "ceiling") + + def test_closing_the_whole_fleet_at_once_is_early_for_the_young_ones(self): + got = read(ramp(lambda t: opened(t) if t >= 100 else 0)) + self.assertEqual(got["stop"], "shed") + self.assertEqual(got["stop_t"], 100.0) + + def test_it_counts_from_where_the_server_starts_shedding_early(self): + # a 60 s timeout until t=60, then everything older than 5 s is closed + rows = ramp(lambda t: opened(t - 60) if t <= 60 else opened(t - 5)) + got = read(rows) + self.assertEqual(got["stop"], "shed") + self.assertEqual(got["stop_t"], 65.0) + self.assertEqual(got["reached"], + rows[11]["active"] + rows[11]["idle_opened"]) # t = 60 + + def test_the_rate_and_the_p99_are_still_the_limit(self): + rows = ramp(lambda t: 0) + for r in rows[6:]: + r["p99_us"] = 5_000 + self.assertEqual(read(rows)["stop"], "p99") + for r in rows[6:]: + r["rps"] = 10 + self.assertEqual(read(rows)["stop"], "rate") + + def test_a_timeline_without_idle_connections_has_no_age(self): + rows = [dict(t=5.0, p99_us=800, rps=100_000, active=5_000)] + self.assertIsNone(conn_hold.idle_age(rows, 0)) + self.assertEqual(read(rows)["stop"], "ceiling") + + def test_the_default_minimum_is_thirty_seconds(self): + self.assertEqual(conn_hold.IDLE_MIN_S, 30.0) + self.assertEqual(conn_hold.IDLE_SLACK_S, 1.0) + + +class RampScoreTests(unittest.TestCase): + P = "connections-ramp-h1" + + def test_the_score_is_the_share_of_two_million_reached(self): + rows = [{"reached": r} for r in (2_000_000, 1_000_000, 0, None)] + latency_score.score_rows(rows, self.P) + self.assertEqual([r["score"] for r in rows], [100.0, 50.0, 0.0, 0.0]) + + def test_pick_keeps_the_run_that_got_furthest(self): + with tempfile.TemporaryDirectory() as directory: + d = Path(directory) + for run, reached in ((1, 900_000), (2, 1_400_000), (3, 1_100_000)): + (d / f"{run}.kv").write_text( + f"rps=100000\nramp_reached={reached}\nstatus_2xx=1\n") + (d / f"{run}.meta").write_text("cpu_usec=1\n") + self.assertEqual(latency_score.pick(directory, self.P), 2) + + def test_the_board_scores_the_same_rows_the_same_way(self): + html = (ROOT / "site/leaderboard/index.html").read_text() + self.assertIn("'connections-ramp-h1':2000000", html) + self.assertEqual(latency_score.FULL_RATE[self.P], 2_000_000.0) + self.assertIn(self.P, latency_score.RAMP) + + +if __name__ == "__main__": + unittest.main() diff --git a/scripts/tests/test_validate_keepalive.py b/scripts/tests/test_validate_keepalive.py new file mode 100644 index 000000000..5100d66b9 --- /dev/null +++ b/scripts/tests/test_validate_keepalive.py @@ -0,0 +1,105 @@ +"""validate-keepalive.py: what a server has to do to keep idle connections.""" + +from pathlib import Path +import socket +import subprocess +import sys +import threading +import unittest + + +ROOT = Path(__file__).resolve().parents[2] +SCRIPT = ROOT / "scripts" / "validate-keepalive.py" + + +class Server(threading.Thread): + """One thread per connection, answering GET /baseline11 until the idle timeout.""" + + def __init__(self, idle=None, wrong=False, close=False): + super().__init__(daemon=True) + self.idle, self.wrong, self.close = idle, wrong, close + self.sock = socket.create_server(("127.0.0.1", 0)) + self.port = self.sock.getsockname()[1] + + def run(self): + while True: + try: + conn, _ = self.sock.accept() + except OSError: + return + threading.Thread(target=self.serve, args=(conn,), daemon=True).start() + + def serve(self, conn): + conn.settimeout(self.idle) + try: + while True: + head = b"" + while b"\r\n\r\n" not in head: + chunk = conn.recv(4096) + if not chunk: + return + head += chunk + query = head.split(b" ")[1].split(b"?", 1)[1].split(b"&") + a, b = (int(q.split(b"=")[1]) for q in query) + body = str(1 if self.wrong else a + b).encode() + conn.sendall(b"HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n" + + (b"Connection: close\r\n" if self.close else b"") + + b"Content-Length: %d\r\n\r\n%s" % (len(body), body)) + if self.close: + return + except OSError: + pass # the idle timeout, or the client going away + finally: + conn.close() + + +class KeepaliveTests(unittest.TestCase): + def run_check(self, idle_seconds, **server): + s = Server(**server) + s.start() + try: + out = subprocess.run( + [sys.executable, "-B", str(SCRIPT), "127.0.0.1", str(s.port), + str(idle_seconds), "6"], capture_output=True, text=True, timeout=30) + finally: + s.sock.close() + return out.returncode, out.stdout + out.stderr + + def test_a_server_that_keeps_the_connection_passes(self): + code, out = self.run_check(1, idle=None) + self.assertEqual(code, 0, out) + self.assertIn("1 passed, 0 failed", out) + + def test_a_server_that_closes_early_fails_and_says_after_how_long(self): + code, out = self.run_check(1.5, idle=0.5) + self.assertEqual(code, 1) + self.assertIn("0 passed, 1 failed", out) + self.assertIn("6 closed while idle", out) + self.assertIn("first after 0.5 s", out) + + def test_a_server_that_closes_after_the_wait_passes(self): + code, out = self.run_check(1, idle=30) + self.assertEqual(code, 0, out) + + def test_a_wrong_answer_fails(self): + code, out = self.run_check(1, idle=None, wrong=True) + self.assertEqual(code, 1) + self.assertIn("first request", out) + + def test_connection_close_fails(self): + code, out = self.run_check(1, idle=None, close=True) + self.assertEqual(code, 1) + self.assertIn("Connection: close", out) + + def test_nothing_listening_fails(self): + s = socket.create_server(("127.0.0.1", 0)) + port = s.getsockname()[1] + s.close() + out = subprocess.run([sys.executable, "-B", str(SCRIPT), "127.0.0.1", str(port), "1", "2"], + capture_output=True, text=True, timeout=30) + self.assertEqual(out.returncode, 1, out.stdout) + self.assertIn("0 passed, 1 failed", out.stdout) + + +if __name__ == "__main__": + unittest.main() diff --git a/scripts/validate-keepalive.py b/scripts/validate-keepalive.py new file mode 100644 index 000000000..b5d482315 --- /dev/null +++ b/scripts/validate-keepalive.py @@ -0,0 +1,211 @@ +#!/usr/bin/env python3 +"""Idle keep-alive validation for HttpArena's connections-ramp-h1 (CON-RAMP). + +CON-RAMP opens two million connections, 95% of which send one request and are +then left idle. A server may close an idle connection, but has to keep it for at +least 30 seconds first: without a floor, a server with a five second timeout +holds a few percent of the fleet and the profile measures how fast it can churn +connections, not how many it can carry. + +This opens a handful of connections, sends one request on each, leaves them +alone for just under that long and sends a second one on the same connection. +Both requests have to be answered correctly. A connection the server closed in +the meantime fails, and the output says how long it lasted. + +The wait is one second under the 30: a server's timer may be coarse (actix's +clock ticks every 500 ms, so a 30 s timeout closes at 29.5 to 30), and the point +is the order of magnitude, not the last second of a timer. + +Usage: python3 validate-keepalive.py [host] [port] [idle_seconds] [connections] + Defaults: localhost 8080 29 32 + Exit code 0 = all passed, 1 = failures +""" + +import random +import selectors +import socket +import sys +import time + +HOST = sys.argv[1] if len(sys.argv) > 1 else "localhost" +PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 8080 +IDLE = float(sys.argv[3]) if len(sys.argv) > 3 else 29.0 +CONNS = int(sys.argv[4]) if len(sys.argv) > 4 else 32 + +CONNECT_TIMEOUT = 10 +RESPONSE_TIMEOUT = 10 + +# More than this many connections failing the same way says it once each. +MAX_SHOWN = 5 + + +class Conn: + def __init__(self, n): + self.n = n + self.sock = None + self.answered_at = 0.0 # when the response to the first request was in + self.lived = None # seconds it lasted idle, if the server closed it + self.error = "" # what went wrong, if anything + + def ok(self): + return not self.error and self.lived is None + + +def request(a, b): + return (f"GET /baseline11?a={a}&b={b} HTTP/1.1\r\n" + f"Host: {HOST}\r\n\r\n").encode("latin-1") + + +def read_response(sock, timeout): + """(status, body, why) - one response off the wire, reading no further than + its end. status is None if there was no complete response.""" + sock.settimeout(timeout) + buf = b"" + while b"\r\n\r\n" not in buf: + chunk = sock.recv(4096) + if not chunk: + return None, "", "closed before answering" if buf == b"" else "closed mid-response" + buf += chunk + head, _, rest = buf.partition(b"\r\n\r\n") + lines = head.split(b"\r\n") + try: + status = int(lines[0].split(b" ")[1]) + except (IndexError, ValueError): + return None, "", "not a status line: %r" % lines[0][:60] + hdrs = {} + for line in lines[1:]: + k, _, v = line.partition(b":") + hdrs[k.strip().lower()] = v.strip() + if hdrs.get(b"connection", b"").lower() == b"close": + return status, "", "the server sent Connection: close" + if b"transfer-encoding" in hdrs: + body, rest = b"", rest + while True: + while b"\r\n" not in rest: + chunk = sock.recv(4096) + if not chunk: + return None, "", "closed mid-response" + rest += chunk + size, _, rest = rest.partition(b"\r\n") + n = int(size.split(b";")[0] or b"0", 16) + while len(rest) < n + 2: + chunk = sock.recv(4096) + if not chunk: + return None, "", "closed mid-response" + rest += chunk + body, rest = body + rest[:n], rest[n + 2:] + if n == 0: + break + elif b"content-length" in hdrs: + n = int(hdrs[b"content-length"]) + while len(rest) < n: + chunk = sock.recv(4096) + if not chunk: + return None, "", "closed mid-response" + rest += chunk + body, rest = rest[:n], rest[n:] + else: + return None, "", "no Content-Length and not chunked, so the end of the response cannot be told" + return status, body.decode("utf-8", "replace").strip(), "" + + +def ask(conn, a, b, what): + """Send one request, check the answer. Sets conn.error on a wrong one.""" + try: + conn.sock.sendall(request(a, b)) + status, body, why = read_response(conn.sock, RESPONSE_TIMEOUT) + except socket.timeout: + conn.error = "%s: no answer within %d s" % (what, RESPONSE_TIMEOUT) + return + except OSError as e: + conn.error = "%s: %s" % (what, e) + return + if why: + conn.error = "%s: %s" % (what, why) + elif status != 200 or body != str(a + b): + conn.error = "%s: expected 200 %d, got %s %r" % (what, a + b, status, body[:40]) + + +def open_all(): + conns = [Conn(i) for i in range(CONNS)] + for c in conns: + try: + c.sock = socket.create_connection((HOST, PORT), timeout=CONNECT_TIMEOUT) + c.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) + except OSError as e: + c.error = "connect: %s" % e + return conns + + +def wait_idle(conns): + """Watch the answered connections until every one has been idle for IDLE + seconds, and record the ones the server closes before that.""" + live = [c for c in conns if c.ok()] + end = max(c.answered_at for c in live) + IDLE + sel = selectors.DefaultSelector() + for c in live: + c.sock.setblocking(False) + sel.register(c.sock, selectors.EVENT_READ, c) + while True: + left = end - time.monotonic() + if left <= 0 or not sel.get_map(): + break + for key, _ in sel.select(timeout=left): + c = key.data + now = time.monotonic() + try: + data = c.sock.recv(4096) + except OSError as e: + data, c.error = b"", str(e) + # a FIN or a reset is the server closing it; anything else arrived + # unasked (some servers say 408 before they do) + c.lived = now - c.answered_at + if data: + c.error = "sent %d bytes nobody asked for: %r" % (len(data), data[:60]) + sel.unregister(c.sock) + sel.close() + + +def main(): + conns = open_all() + for c in conns: + if c.error: + continue + a, b = random.randint(100, 999), random.randint(100, 999) + ask(c, a, b, "first request") + c.answered_at = time.monotonic() + ready = [c for c in conns if c.ok()] + if ready: + wait_idle(conns) + for c in ready: + if not c.ok(): + continue + c.sock.setblocking(True) + a, b = random.randint(100, 999), random.randint(100, 999) + ask(c, a, b, "second request, after %.0f s idle" % IDLE) + + bad = [c for c in conns if not c.ok()] + good = len(conns) - len(bad) + print(" %s [keep-alive: idle for %.0f s, then used again] %d of %d connections" + % ("PASS" if not bad else "FAIL", IDLE, good, len(conns))) + early = [c for c in bad if c.lived is not None] + if early: + print(" %d closed while idle: first after %.1f s, last after %.1f s. " + "Keep an idle connection open for at least 30 seconds" + % (len(early), min(c.lived for c in early), max(c.lived for c in early))) + shown = {} + for c in bad: + if c.lived is not None and not c.error: + continue + shown[c.error] = shown.get(c.error, 0) + 1 + for text, n in list(shown.items())[:MAX_SHOWN]: + print(" %d: %s" % (n, text)) + for c in conns: + if c.sock is not None: + c.sock.close() + print("=== %d passed, %d failed ===" % (1 if not bad else 0, 1 if bad else 0)) + sys.exit(1 if bad else 0) + + +if __name__ == "__main__": + main() diff --git a/scripts/validate.sh b/scripts/validate.sh index 752ceca2e..23fea0667 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -1251,7 +1251,7 @@ wait_h2() { # The fixed-rate profiles drive GET /baseline11, so they need the same # handler to be correct and gets its coverage from this section rather than # one of its own -- there is nothing about it a request-shaped check can see. -if has_test "baseline" || has_test "limited-conn" || has_test "latency-1m" || has_test "latency-10k" || has_test "connections-5m" || has_test "connections-1m-tls" || has_test "connections-1m"; then +if has_test "baseline" || has_test "limited-conn" || has_test "latency-1m" || has_test "latency-10k" || has_test "connections-5m" || has_test "connections-1m-tls" || has_test "connections-1m" || has_test "connections-ramp-h1"; then BASELINE_DOCS="$DOCS_BASE/h1/baseline/validation" echo "[test] baseline endpoints" check "GET /baseline11?a=13&b=42" "55" "$BASELINE_DOCS" \ @@ -1355,19 +1355,39 @@ fi # ───── Held connections: a listener on every loopback address ───── # connections-5m spreads its five million connections over 127.0.0.1- -# 127.0.0.160 (connections-1m its million over .1-.32), because one source -# address holds at most ~64K connections to one destination. A server bound to +# 127.0.0.160 (connections-1m its million over .1-.32, connections-ramp-h1 its +# two million over .1-.64), because one source address holds at most ~64K +# connections to one destination. A server bound to # 127.0.0.1 or "localhost" passes every check above and refuses all of these # but the first, so the profiles ask for a listener on 0.0.0.0 or [::] and this # is where an entry finds out. Both ends of the widest range. HELD_DOCS="$DOCS_BASE/h1/connections/validation" -if has_test "connections-5m" || has_test "connections-1m"; then +if has_test "connections-5m" || has_test "connections-1m" || has_test "connections-ramp-h1"; then echo "[test] held connections: listener on every address" check "GET /baseline11 on 127.0.0.2" "55" "$HELD_DOCS" \ "http://127.0.0.2:$PORT/baseline11?a=13&b=42" check "GET /baseline11 on 127.0.0.160" "55" "$HELD_DOCS" \ "http://127.0.0.160:$PORT/baseline11?a=13&b=42" fi +# connections-ramp-h1: 95% of its two million connections are idle after one +# request. A server may close an idle connection, but has to keep it for 30 +# seconds first: with a five second keep-alive it holds a few percent of the fleet +# and the profile measures how fast it can churn connections instead of how many +# it can carry. The check waits 29 s - a second for timers that run coarse - and +# the run is held to the same (scripts/conn_hold.py, idle_age). +if has_test "connections-ramp-h1"; then + echo "[test] connections-ramp-h1: idle connections kept for 30 seconds" + IDLE_OUTPUT=$(python3 "$SCRIPT_DIR/validate-keepalive.py" localhost "$PORT" 29 2>&1) || true + echo "$IDLE_OUTPUT" + # A helper that died before its summary line is a failure, not a skip. + IDLE_PASS=$(printf '%s\n' "$IDLE_OUTPUT" | grep -oP '\d+(?= passed)' | tail -1 || true) + IDLE_FAIL=$(printf '%s\n' "$IDLE_OUTPUT" | grep -oP '\d+(?= failed)' | tail -1 || true) + PASS=$((PASS + ${IDLE_PASS:-0})) + FAIL=$((FAIL + ${IDLE_FAIL:-1})) + if [ "${IDLE_FAIL:-1}" -gt 0 ]; then + echo " → $DOCS_BASE/h1/connections-ramp/validation" + fi +fi # connections-1m-tls: a million over TLS on the h1 TLS port (127.0.0.1-.32), # where the baseline GET has to answer too, and over TLS 1.3 - the only # version gcannon offers - or every handshake of the run fails. diff --git a/site/content/docs/add-framework/meta-json.md b/site/content/docs/add-framework/meta-json.md index 19460646d..15edb8dd6 100644 --- a/site/content/docs/add-framework/meta-json.md +++ b/site/content/docs/add-framework/meta-json.md @@ -54,6 +54,7 @@ Create a `meta.json` file in your framework directory: | `connections-1m` | HTTP/1.1 | `/baseline11` (CON-1M: 1M held connections at a fixed 250K req/s; needs a listener on `0.0.0.0` or `[::]` and an idle timeout of 5 s or more) | | `connections-1m-tls` | HTTP/1.1 + TLS | `/baseline11` on port 8081 over TLS 1.3 (CON-1M-TLS: 1M held connections at 250K req/s; same requirements) | | `connections-5m` | HTTP/1.1 | `/baseline11` (CON-5M: 5M held connections at 1.25M req/s; same requirements, and runs only if the entry is on `scripts/connections-5m-allowlist.json`) | +| `connections-ramp-h1` | HTTP/1.1 | `/baseline11` (CON-RAMP: 2M connections opened over two minutes, 95% of them idle after one request, at 100K req/s; needs a listener on `0.0.0.0` or `[::]`, room for two million connections, and idle connections kept for at least 30 seconds) | | `json-comp` | HTTP/1.1 | `/json/{count}?m=N` (must honor `Accept-Encoding: gzip, br`) | | `json-tls` | HTTP/1.1 + TLS | `/json/{count}?m=N` (port 8081, ALPN `http/1.1`) | | `8gbit` | HTTP/1.1 + TLS | `POST /echo` on port 8081 (10 KB echoed verbatim) | diff --git a/site/content/docs/load-generators/h1/gcannon.md b/site/content/docs/load-generators/h1/gcannon.md index 103a6f016..d3e4801b4 100644 --- a/site/content/docs/load-generators/h1/gcannon.md +++ b/site/content/docs/load-generators/h1/gcannon.md @@ -94,7 +94,9 @@ Everywhere else gcannon sends the next request the moment the last response arri A fleet that large needs four more options. `--addr-span` spreads it over consecutive loopback addresses, since one source address holds about 64.5K connections to one destination. `--connect-limit` caps the first connects in flight per thread, so millions of SYNs never land at once; over `https://` a connection counts until its handshake is done, so the server is never handed more handshakes than it completes. `--warmup-max` lets the warmup wait long enough for every connection to open, and `--settle` keeps the load running after that, before the window opens, so the server has worked off the connect phase by the time measuring starts. On stderr gcannon marks the window's start and end (`gcannon: warmup done ...`, `gcannon: measurement done`), which `scripts/conn_hold.py` uses to read the server's CPU over exactly that window. -The held-connection profiles need gcannon 0.8.2 or later, and 0.8.4 or later over TLS. `gcannon --version` prints the version. +With `--ramp-up` the connections beyond `--ramp` open evenly over a duration instead of all at once, and with `--idle` part of them send a single request and are then left alone; [CON-RAMP](/docs/test-profiles/h1/connections-ramp/implementation/) is built on both. There the rate belongs to the thread, not to any one connection, since the active ones come and go: each thread sends its own share of it to whichever connection has been free the longest, and gcannon reports a line per interval. + +The held-connection profiles need gcannon 0.8.2 or later, 0.8.4 or later over TLS, and 0.10.0 or later for CON-RAMP. `gcannon --version` prints the version. ## Command-line reference diff --git a/site/content/docs/running-locally/configuration.md b/site/content/docs/running-locally/configuration.md index 23acd5a42..02074350a 100644 --- a/site/content/docs/running-locally/configuration.md +++ b/site/content/docs/running-locally/configuration.md @@ -52,7 +52,7 @@ Each load generator has a pair of variables - native binary name and docker imag | Native (`$TOOL`) | Docker (`$TOOL_IMAGE`) | Used for | Source | |---|---|---|---| -| `GCANNON=gcannon` | `GCANNON_IMAGE=gcannon:latest` | baseline, pipelined, limited-conn, json-comp, async-db, async, fortunes, echo-ws, echo-ws-pipeline, echo-ws-limited, connections-5m, connections-1m-tls | `docker/gcannon.Dockerfile` | +| `GCANNON=gcannon` | `GCANNON_IMAGE=gcannon:latest` | baseline, pipelined, limited-conn, json-comp, async-db, async, fortunes, echo-ws, echo-ws-pipeline, echo-ws-limited, connections-5m, connections-1m-tls, connections-ramp-h1 | `docker/gcannon.Dockerfile` | | `H2LOAD=h2load` | `H2LOAD_IMAGE=h2load:latest` | baseline-h2, static-h2, baseline-h2c, json-h2c, unary-grpc, unary-grpc-tls, gateway-64, production-stack | `docker/h2load.Dockerfile` (Ubuntu + glibc, **not** alpine) | | `H2LOAD_H3=h2load-h3` | `H2LOAD_H3_IMAGE=h2load-h3:local` | baseline-h3, static-h3, gateway-h3 | `docker/h2load-h3.Dockerfile` (quictls + ngtcp2 + nghttp3) | | `WRK=wrk` | `WRK_IMAGE=wrk:local` | static-tls, json-tls | `docker/wrk.Dockerfile` | @@ -96,7 +96,7 @@ From `endpoint_tool()` in `scripts/lib/profiles.sh`: | `latency-1m`, `latency-10k`, `8gbit`, `connections-1m` | zrk | | `h2`, `static-h2`, `h2c`, `json-h2c`, `gateway-64`, `grpc`, `grpc-tls`, `production-stack` | h2load | | `h3`, `static-h3`, `gateway-h3` | h2load-h3 | -| everything else (`""`, `pipeline`, `async-db`, `async`, `fortunes`, `json-compressed`, `ws-echo`, `connections-5m`, `connections-1m-tls`) | gcannon | +| everything else (`""`, `pipeline`, `async-db`, `async`, `fortunes`, `json-compressed`, `ws-echo`, `connections-5m`, `connections-1m-tls`, `connections-ramp-h1`) | gcannon | ## Small-machine overrides diff --git a/site/content/docs/running-locally/prerequisites.md b/site/content/docs/running-locally/prerequisites.md index c2c6b46cd..4d13faf39 100644 --- a/site/content/docs/running-locally/prerequisites.md +++ b/site/content/docs/running-locally/prerequisites.md @@ -51,7 +51,7 @@ The one exception is `zrk`, which drives `8gbit`: `benchmark-lite.sh` does not b For the default (native) mode, install each tool the host binary. If anything is missing, set `LOADGEN_DOCKER=true` and the script falls back to the same docker images `benchmark-lite.sh` uses. -- **gcannon** - io_uring HTTP/1.1, WebSocket, and `--raw` multi-template generator. Requires Linux kernel ≥ 6.1 with `io_uring` enabled. `connections-5m` needs gcannon ≥ 0.8.2 (`--rate`, `--addr-span`), and `connections-1m-tls` ≥ 0.8.4 (`--connect-limit` held through the TLS handshake); `gcannon --version` prints it, and an older build has no `--version` at all. +- **gcannon** - io_uring HTTP/1.1, WebSocket, and `--raw` multi-template generator. Requires Linux kernel ≥ 6.1 with `io_uring` enabled. `connections-5m` needs gcannon ≥ 0.8.2 (`--rate`, `--addr-span`), `connections-1m-tls` ≥ 0.8.4 (`--connect-limit` held through the TLS handshake), and `connections-ramp-h1` ≥ 0.10.0 (`--ramp-up`, `--idle`); `gcannon --version` prints it, and an older build has no `--version` at all. ```bash git clone --branch liburing-2.9 https://github.com/axboe/liburing.git diff --git a/site/content/docs/running-locally/scripts/benchmark-lite.md b/site/content/docs/running-locally/scripts/benchmark-lite.md index 1bd424e77..4f360333f 100644 --- a/site/content/docs/running-locally/scripts/benchmark-lite.md +++ b/site/content/docs/running-locally/scripts/benchmark-lite.md @@ -15,7 +15,7 @@ weight: 4 | CPU pinning | Per-profile `--cpuset-cpus` | None - all containers see every core | | `THREADS` default | 64 | `nproc / 2` | | `H2THREADS` / `H3THREADS` default | 64 / 64 | Same as `THREADS` | -| Profile set | 29 profiles | 13 - skips `json-tls`, `static-tls`, `async`, `latency-1m`, `latency-10k`, `connections-5m`, `connections-1m-tls`, `connections-1m`, `fortunes`, `baseline-h2c`, `json-h2c`, `gateway-64`, `gateway-h3`, `production-stack`, `echo-ws-pipeline`, `echo-ws-limited` | +| Profile set | 30 profiles | 13 - skips `json-tls`, `static-tls`, `async`, `latency-1m`, `latency-10k`, `connections-5m`, `connections-1m-tls`, `connections-1m`, `connections-ramp-h1`, `fortunes`, `baseline-h2c`, `json-h2c`, `gateway-64`, `gateway-h3`, `production-stack`, `echo-ws-pipeline`, `echo-ws-limited` | | Connection counts | Varies (512, 1024, 4096, 16384, …) | One per profile (mostly 512; h3 64) | | Framework selection | One framework, always | Optional - runs every enabled framework if omitted | diff --git a/site/content/docs/running-locally/scripts/benchmark.md b/site/content/docs/running-locally/scripts/benchmark.md index 1cbccad8d..225dd71bb 100644 --- a/site/content/docs/running-locally/scripts/benchmark.md +++ b/site/content/docs/running-locally/scripts/benchmark.md @@ -139,6 +139,7 @@ pipeline | req_per_conn | cpu_limit | connections | endpoint | `connections-5m` | 1 | ∞ | `0-31,64-95` | 5000000 | gcannon `--rate` (≥ 0.8.2) | `/baseline11` paced at 1.25M req/s over 5M held connections on 127.0.0.1-.160, 20s window | | `connections-1m-tls` | 1 | ∞ | `0-31,64-95` | 1000000 | gcannon `--rate` (≥ 0.8.4) | `/baseline11` over TLS 1.3 on `H1TLS_PORT`, paced at 250K req/s over 1M held connections on 127.0.0.1-.32 | | `connections-1m` | 1 | ∞ | `0-31,64-95` | 1000000 | zrk 3.0.2, one per address | `/baseline11` paced at 250K req/s over 1M held connections on 127.0.0.1-.32 | +| `connections-ramp-h1` | 1 | ∞ | `0-31,64-95` | 2000000 | gcannon `--ramp-up --idle` (≥ 0.10.0) | `/baseline11` at 100K req/s while 2M connections open over 120s on 127.0.0.1-.64, 95% idle; ends where the p99 passes 2 ms | | `json-comp` | 1 | ∞ | `0-31,64-95` | 4096, 16384 | gcannon | `/json/{count}` + `Accept-Encoding: gzip, br` | | `json-tls` | 1 | ∞ | `0-31,64-95` | 4096 | wrk | `/json/{count}` over TLS on `H1TLS_PORT` | | `8gbit` | 1 | ∞ | `0-31,64-95` | 512 | zrk | `POST /echo` on TLS `:8081` - 10 KB echoed, paced at 50k req/s | diff --git a/site/content/docs/scoring/composite-score.md b/site/content/docs/scoring/composite-score.md index 03f114387..f6b783222 100644 --- a/site/content/docs/scoring/composite-score.md +++ b/site/content/docs/scoring/composite-score.md @@ -81,6 +81,7 @@ The tables below show whether a profile counts for framework entries. Engines an | CON-1M | Yes | One million held connections at a fixed 250K req/s; scored on CPU per request, memory, p50 and p99 ([held-connection score](/docs/test-profiles/h1/connections/implementation/#scoring)) | | CON-1M-TLS | Yes | The same over TLS 1.3 | | CON-5M | No (*) | Five million held connections at 1.25M req/s. Reference-only, and run only for the entries on the allowlist | +| CON-RAMP | No (*) | A ramp to two million connections, 95% of them idle, while the active ones hold 100K req/s: how many it reached before their p99 passed 2 ms. Reference-only | | JSON Compressed | Yes | JSON with `Accept-Encoding: gzip, br` and multiplier `?m=N` | | JSON TLS | Yes | JSON workload over HTTP/1.1 + TLS on port 8081 | | 8Gbit | Yes | 10 KB echoed over TLS at a fixed 50K req/s; scored on CPU cost and latency (0-100 score, see above) | diff --git a/site/content/docs/test-profiles/h1/_index.md b/site/content/docs/test-profiles/h1/_index.md index c932515b1..da66d5f84 100644 --- a/site/content/docs/test-profiles/h1/_index.md +++ b/site/content/docs/test-profiles/h1/_index.md @@ -17,6 +17,7 @@ Every HTTP/1.1 profile measures one thing at a time, so a number can be attribut {{< card link="latency-10k" title="Latency-10K" subtitle="Latency-1M's setup at a near-idle 10K req/s; the metric is the CPU and latency of a server with almost nothing to do." icon="chip" >}} {{< card link="latency-1m" title="Latency-1M" subtitle="One million req/s offered at a fixed rate; the metric is the CPU each framework spends to serve it, read exactly from its cgroup." icon="chip" >}} {{< card link="connections" title="Connections (CON-1M, CON-1M-TLS, CON-5M)" subtitle="A million keep-alive connections held at once, a million over TLS 1.3, or five million (by allowlist), with requests paced across them - scored on CPU per request, memory, p50 and p99." icon="globe" >}} + {{< card link="connections-ramp" title="Connections Ramp (CON-RAMP)" subtitle="Two million connections opened over two minutes, 95% of them idle after one request - scored on how many the server takes before the active ones' p99 goes over 2 ms. Reference-only." icon="globe" >}} {{< card link="async-database" title="Async Database (Postgres)" subtitle="Async Postgres range query over 100K rows, connection pooling, and JSON serialization. Ranked on the Database board, with its own CPU split." icon="database" >}} {{< card link="static-tls" title="Static Files over TLS" subtitle="20 static files served over HTTP/1.1 + TLS on port 8081. Reference-only for frameworks and engines, scored for infrastructure." icon="lock-closed" >}} {{< card link="pipelined" title="Pipelined (16x) *" subtitle="16 requests sent back-to-back per connection, testing raw I/O and pipeline batching. Reference-only - not part of the composite score." icon="fast-forward" >}} diff --git a/site/content/docs/test-profiles/h1/connections-ramp/_index.md b/site/content/docs/test-profiles/h1/connections-ramp/_index.md new file mode 100644 index 000000000..18cf8b977 --- /dev/null +++ b/site/content/docs/test-profiles/h1/connections-ramp/_index.md @@ -0,0 +1,14 @@ +--- +title: Connections Ramp +seo_title: "CON-RAMP: a Ramp to Two Million Mostly Idle Connections" +description: "Opens connections evenly over two minutes up to two million, 95% of them idle, and measures how many the server takes before the p99 of the active ones goes over 2 ms." +--- + +Two million connections are opened over two minutes, evenly, and 95% of them go quiet after one request: the way users connect to a service and then mostly do nothing. The other 5% keep a fixed 100,000 req/s going the whole time. The score is how far the ramp got before those active connections' p99 went over 2 ms. + +What the server does with the quiet connections is part of the question. Holding them costs memory, closing them costs nothing more than noticing; a keep-alive timeout, or any policy that closes what is idle, is a legitimate answer and the profile reports what it closed. What it must not do is let the active traffic suffer for it, or close a connection that has been idle for less than 30 seconds: without a floor, a server with a five second timeout holds a few percent of the fleet, and the profile would be measuring how fast it can open and close connections. + +{{< cards >}} + {{< card link="implementation" title="Implementation Guidelines" subtitle="What the listener must allow, how the load is run, what is measured, and how it is scored." icon="code" >}} + {{< card link="validation" title="Validation" subtitle="All checks executed by the validation script for this test profile." icon="check-circle" >}} +{{< /cards >}} diff --git a/site/content/docs/test-profiles/h1/connections-ramp/implementation.md b/site/content/docs/test-profiles/h1/connections-ramp/implementation.md new file mode 100644 index 000000000..de9038031 --- /dev/null +++ b/site/content/docs/test-profiles/h1/connections-ramp/implementation.md @@ -0,0 +1,96 @@ +--- +title: Implementation Guidelines +seo_title: "CON-RAMP Benchmark: Implementation Guide" +description: "What to implement, what the listener must allow, how the ramp is run, what is measured, and how CON-RAMP (connections-ramp-h1) is scored." +--- +{{< type-rules standard="Nothing new to implement - the profile drives `GET /baseline11`, which the baseline profile already specifies and validates. It asks for a server that can accept two million connections over two minutes while a small active part of them stays under a 2 ms p99: it must listen on every loopback address (0.0.0.0 or [::], not 127.0.0.1 or localhost) and must not cap connections below the fleet. Closing a connection that has been idle for at least 30 seconds is allowed and counted; closing one sooner is not, and is validated." tuned="May size buffers, pools, accept loops and timeouts for the fleet, raise connection caps, and set the runtime's heap and GC options, but an idle connection still has to be kept for at least 30 seconds. All of it is charged: memory is read from the container, which is capped at 128 GiB." engine="Same as above. An engine with a fixed-size connection table, or one that preallocates a full read buffer per connection, finds out here." >}} + +`GET /baseline11?a=1&b=2` is the only request. The fleet is two million connections, opened evenly over two minutes: **95% of them are idle** - they connect, send the one request, read its answer, and are never used or reopened - and **5% are active**: 100,000 connections that carry a fixed 100,000 req/s between them. 4,096 of the active ones are open before the ramp starts; the rest of them, and every idle one, open on the way up. + +| | | +|---|---| +| Profile | `connections-ramp-h1` | +| Connections | 2,000,000 over 127.0.0.1-.64, 31,250 on each address | +| Idle | 95%: one request each, then nothing | +| Active | 5% (100,000): 100,000 req/s, held throughout | +| Ramp | 4,096 active connections first, then everything else evenly over 120 s | +| Window | 130 s: the ramp, then ten seconds of the full fleet | +| p99 limit | 2 ms, on the active connections, read every 5 s | +| Load generator | one gcannon, `--ramp-up`, `--idle`, `--rate` (0.10.0 or later) | +| Scored | no, reference-only while the first field is measured | + +**Endpoint:** `GET /baseline11?a=1&b=2` · **CPU:** cpuset `0-31,64-95` · **Memory cap:** 128 GiB + +## What your server must allow + +- **Listen on every address.** One client address can hold about 64.5K connections to one server address and port, so the fleet is spread over loopback addresses, 31,250 connections on each: `127.0.0.1`-`127.0.0.64`. A listener on `0.0.0.0` or `[::]` accepts on all of them. [Validation](../validation) checks this, and the run checks it again before it starts. +- **No connection cap below the fleet.** Raise any per-worker or global connection limit above two million. +- **File descriptors.** The container is started with `--ulimit nofile` at 8,388,608, capped at the host's `fs.nr_open`. A server that lowers its own limit, or spends more than one descriptor per connection, has to leave room for the fleet. +- **Keep an idle connection for at least 30 seconds.** An idle connection sends one request and is never used again, and closing it after that is a decision the profile measures - but not before 30 seconds. The keep-alive timeout of your server has to be above that (the default is 5 seconds in actix-web and node:http, 75 in nginx, 120 in Go's fib, 130 in Kestrel): a short one holds a few percent of the fleet, and the profile would be measuring how fast it opens and closes connections. [Validation](../validation/#idle-connections-are-kept) checks it, and [so does the run](#the-idle-minimum). The active ones send one request a second, well inside any timeout this allows. + +## How the load is run + +[gcannon](/docs/load-generators/h1/gcannon/) opens the fleet and drives it, under [`scripts/conn_hold.py`](https://github.com/MDA2AV/HttpArena/blob/main/scripts/conn_hold.py), which probes the listener, refuses a run the host cannot hold, raises the open-file limit, and reads the server's CPU from its cgroup over the measured window. + +| gcannon option | Value | +|---|---| +| `-c` / `-t` | 2,000,000 / 64 | +| `--idle` | 95% | +| `--ramp` / `--ramp-up` | 4096 / 120s | +| `--rate` | 100,000 | +| `--addr-span` | 64 | +| `--connect-limit` (per thread) | 64 | +| `--warmup-max` / `--settle` | 60s / 30s | +| `-d` | 130s | + +The 4,096 active connections open in the warmup and carry the offered rate for 30 seconds, which lets a JIT, a garbage collector and the caches settle before anything counts. The window then opens, and the ramp with it: the rest of the active connections and all the idle ones open evenly over 120 seconds, about 16,600 a second. The rate stays at 100,000 req/s throughout, paced by thread over whichever active connections are open, so the total does not depend on how many that is. Latency counts from each request's scheduled time. + +Each interval (five seconds), gcannon reports how many connections are open, how many idle ones have been opened and closed so far, and the active connections' rate and latency in it. Those lines are the result. + +**The p99 limit is the harness's.** gcannon does not stop at it. The run takes the full two minutes, and the harness then finds where the intervals crossed 2 ms: an interval over the limit, followed by another that is too (or at the end of the window), is where the ramp ends. A single noisy interval between two good ones is ignored. An interval whose rate falls short of 90% of the offered one counts as over the limit as well: a server that has stopped answering has no p99 worth the name. + +### The idle minimum + +Closing an idle connection is allowed, but only one that has been idle for at least 30 seconds. The same intervals say whether a server did: gcannon reports how many idle connections it has opened and how many the server has closed so far, and since a server that gives each connection the same time closes them oldest first, the time since the n-th was opened, for the n-th close, is how long it was kept. An interval in which that is under 29 seconds - a second of slack for timers that are coarse - ends the ramp like an interval over the p99 limit does, with `ramp_stop` `shed`. It is the average over the closes so far, so a few stray resets, under 1% of the idle connections opened, do not count. A server with a short timeout is scored on what the ramp had opened before its first closes: nothing with a five second one, about 340,000 connections with a twenty second one. + +The run starts on a fresh server, once the host's TCP socket count is back near what it was before the first profile, as on the [held-connection profiles](../../connections/implementation/#how-the-load-is-run). There is one run, not several: the ramp is the measurement, and a warm-up precedes it. + +## What is measured + +| field | meaning | +|---|---| +| `ramp_reached` | connections opened by the last interval that held the 2 ms p99, idle ones included: every one the ramp had opened, whether or not the server has closed some of them since. The score is this | +| `connections_open` | the most of them that were open at once, in any interval up to then ("Peak open" on the board) | +| `idle_closed` | idle connections the server had closed by then ("Closed" on the board) | +| `ramp_stop` | what ended the ramp: `p99` (over the limit), `rate` (short of it), `shed` (an idle connection closed before 30 seconds), or `ceiling` (the whole two million were opened within it) | +| `memory` | the container's peak memory across the run | +| `cpu_usec`, `cpu_per_req_us` | server CPU microseconds over the window, read from cgroup v2 `cpu.stat`, and divided by requests served | +| `p50_latency`, `p99_latency`, `avg_latency`, `p99_9_latency` | the active connections' over the whole run, coordinated-omission corrected. The per-interval p99 that stops the ramp is the one in the log | +| `rate_ratio` | achieved over offered across the run | + +## Parameters + +| Parameter | Value | +|-----------|-------| +| Endpoint | `GET /baseline11?a=1&b=2` (GET only, no body) | +| Connections | 2,000,000 over 127.0.0.1-127.0.0.64, 31,250 per address | +| Idle | 95%, one request each | +| Offered rate | 100,000 req/s over the active connections | +| Ramp | 120s, uniform, after 4,096 active connections | +| p99 limit | 2 ms, read on each 5 s interval | +| Idle connections | kept for at least 30 s | +| CPU | cpuset `0-31,64-95` (32 cores, both threads) | +| Memory cap | 128 GiB (`CONN5M_MEM_LIMIT`), a server above it is OOM-killed | +| Window | 130s | +| Runs | 1, after a 30 s warm-up at the offered rate on the floor of the fleet; repeating the two-minute ramp would not say more | +| Load generator | [gcannon](/docs/load-generators/h1/gcannon/) 0.10.0 or later | + +## Scoring + +``` +score = 100 x min(1, ramp_reached / 2,000,000) +``` + +How many connections the ramp opened before the active ones' p99 went over 2 ms. A server that opened all two million scores 100; one that closed idle connections after 30 seconds and held its active p99 all the way scores 100 as well, and the Peak open and Closed columns show how it got there. Computed by [`scripts/latency_score.py`](https://github.com/MDA2AV/HttpArena/blob/main/scripts/latency_score.py); the board computes the same. Reference-only: measured and shown, part of no composite. + +Subscribe by adding `connections-ramp-h1` to `tests` in your `meta.json`. diff --git a/site/content/docs/test-profiles/h1/connections-ramp/validation.md b/site/content/docs/test-profiles/h1/connections-ramp/validation.md new file mode 100644 index 000000000..11001d854 --- /dev/null +++ b/site/content/docs/test-profiles/h1/connections-ramp/validation.md @@ -0,0 +1,35 @@ +--- +title: Validation +seo_title: "CON-RAMP Benchmark: Validation Checks" +description: "How correctness is established for CON-RAMP, and the listener checks that are specific to it." +--- + +The profile drives `GET /baseline11?a=1&b=2`, the baseline endpoint unchanged, so an entry subscribed to `connections-ramp-h1` is run through the full [baseline validation suite](../../baseline/validation): the arithmetic, the `Content-Type`, the randomized-input anti-cheat, the TCP fragmentation checks, and the exhaustive per-byte fragmentation sweep. + +## A listener on every address + +One client address can hold only about 64.5K connections to one server address and port, so the ramp's two million are spread over `127.0.0.1` to `127.0.0.64`. The check is the one the [held-connection profiles](../../connections/validation/#a-listener-on-every-address) use, at both ends of the wider range those take: + +| check | request | expected | +|---|---|---| +| GET /baseline11 on 127.0.0.2 | `GET http://127.0.0.2:8080/baseline11?a=13&b=42` | `55` | +| GET /baseline11 on 127.0.0.160 | `GET http://127.0.0.160:8080/baseline11?a=13&b=42` | `55` | + +To pass, listen on `0.0.0.0` or `[::]` (an IPv6 wildcard listener accepts IPv4 connections too, unless it sets `IPV6_V6ONLY`). The benchmark repeats the probe on `127.0.0.2` and `127.0.0.64` before it launches anything, and a server that fails it gets an empty row with the reason rather than millions of connect errors. + +## Idle connections are kept + +95% of the fleet is idle after its first request, and a server that closes such a connection within a few seconds never holds more than a few percent of it. So the check opens 32 connections, sends one request on each, leaves them alone for 29 seconds and sends a second request on the same connections. Both have to be answered correctly, and a connection the server closed in the meantime fails with how long it lasted. + +| check | what it does | expected | +|---|---|---| +| idle connections kept for 30 seconds | 32 connections: one `GET /baseline11`, 29 s idle, a second `GET /baseline11` on the same connection | `200` and the right sum both times, none closed in between | + +The 29 rather than 30 seconds is a second of slack for timers that are coarse. Keep-alive timeouts are set on the server: the default is 5 seconds in actix-web and node:http, for example, which fails. The check takes half a minute, and only entries subscribed to `connections-ramp-h1` run it. `python3 scripts/validate-keepalive.py localhost 8080` runs it on its own. + +## What the run checks + +- **Opened, not just offered.** gcannon counts each connection it opens and each idle one the server closes, so Reached, Peak open and Closed are what happened. +- **Idle connections are kept.** The run is held to the same 30 seconds as the check above: an interval in which the server has closed idle connections younger than that (29, for coarse timers) ends the ramp. +- **`rate_ratio`** is published with the row, and an interval under 90% of the offered rate counts against the ramp whatever its p99. +- **CPU from outside.** As on the other fixed-rate profiles, the harness reads the CPU from the container's cgroup rather than taking it from anything inside the container, over the window only. diff --git a/site/leaderboard/index.html b/site/leaderboard/index.html index ad9956da7..cbd5e6b50 100644 --- a/site/leaderboard/index.html +++ b/site/leaderboard/index.html @@ -1946,7 +1946,7 @@

setupTopScroll(); setupFloatHead(); } - function val(r,k){ if(k==='rps')return r.rps||0; if(k==='held')return r.connections_open!=null?+r.connections_open:0; if(k==='bw')return bw(r.bandwidth); if(k==='bwreq'){var b=bw(r.bandwidth),q=r.rps||0;return q>0?b/q:0;} if(k==='inbw')return bw(r.input_bw); if(k==='avg')return lat(r.avg_latency); if(k==='p99')return lat(r.p99_latency); if(k==='p50')return lat(r.p50_latency); if(k==='l1mscore')return latScore(state.profile,r.fw); if(k==='p999')return lat(r.p99_9_latency); if(k==='cpureq')return (r.cpu_per_req_us!=null)?+r.cpu_per_req_us:Infinity; if(k==='cputot'){var t=cpuTotPct(r); return t==null?Infinity:t;} if(k==='cpu')return cpu(r.cpu); if(k==='mem')return mem(r.memory); if(k==='fw')return (r.fw||'').toLowerCase(); return 0; } + function val(r,k){ if(k==='rps')return r.rps||0; if(k==='held')return r.connections_open!=null?+r.connections_open:0; if(k==='reached')return +r.ramp_reached||0; if(k==='shed')return +r.idle_closed||0; if(k==='bw')return bw(r.bandwidth); if(k==='bwreq'){var b=bw(r.bandwidth),q=r.rps||0;return q>0?b/q:0;} if(k==='inbw')return bw(r.input_bw); if(k==='avg')return lat(r.avg_latency); if(k==='p99')return lat(r.p99_latency); if(k==='p50')return lat(r.p50_latency); if(k==='l1mscore')return latScore(state.profile,r.fw); if(k==='p999')return lat(r.p99_9_latency); if(k==='cpureq')return (r.cpu_per_req_us!=null)?+r.cpu_per_req_us:Infinity; if(k==='cputot'){var t=cpuTotPct(r); return t==null?Infinity:t;} if(k==='cpu')return cpu(r.cpu); if(k==='mem')return mem(r.memory); if(k==='fw')return (r.fw||'').toLowerCase(); return 0; } function fmtBytes(n){ if(n>=1048576)return (n/1048576).toFixed(2)+' MB'; if(n>=1024)return (n/1024).toFixed(1)+' KB'; return Math.round(n)+' B'; } // Explorer columns - profile-specific (json-comp adds BW/req, upload adds In BW); // low-priority columns drop out below width breakpoints so the grid never overflows. @@ -1958,11 +1958,11 @@

// Offered rate that earns the whole rate factor, per profile. 95% of target: // the generator never quite reaches its own number, so the threshold has to // sit below it. Mirrors FULL_RATE in scripts/latency_score.py. - var LAT_FULL={'latency-1m':950000, 'latency-10k':9500, '8gbit':47500, 'connections-5m':1187500, 'connections-1m-tls':237500, 'connections-1m':237500}; + var LAT_FULL={'latency-1m':950000, 'latency-10k':9500, '8gbit':47500, 'connections-5m':1187500, 'connections-1m-tls':237500, 'connections-1m':237500, 'connections-ramp-h1':2000000}; // Logical CPUs each fixed-rate profile is pinned to, per scripts/lib/profiles.sh: // cpuset 0-31,64-95 is 32 cores with both threads, so 64. Used to turn CPU-per-request // into "how much of the machine it was allowed did this take". - var LAT_CPUS={'latency-1m':64, 'latency-10k':64, '8gbit':64, 'connections-5m':64, 'connections-1m-tls':64, 'connections-1m':64}; + var LAT_CPUS={'latency-1m':64, 'latency-10k':64, '8gbit':64, 'connections-5m':64, 'connections-1m-tls':64, 'connections-1m':64, 'connections-ramp-h1':64}; // CPU microseconds per second / 1e6 = cores in use; over the allowance = 0-100%. function cpuTotPct(r,pid){ if(r==null||r.cpu_per_req_us==null) return null; @@ -1975,6 +1975,9 @@

// ratios, p50 and p99 on the three-decade scale. Mirrors HELD in scripts/latency_score.py. var LAT_HELD={'connections-1m':1, 'connections-1m-tls':1, 'connections-5m':1}; var HELD_W_CPU=0.25, HELD_W_MEM=0.25, HELD_W_P50=0.25, HELD_W_P99=0.25; + // CON-RAMP: how many connections the ramp reached within the p99 limit, out of + // the whole fleet. Mirrors RAMP in scripts/latency_score.py. + var LAT_RAMP={'connections-ramp-h1':1}; var _latScores={}; function isLatProfile(pid){ return Object.prototype.hasOwnProperty.call(LAT_FULL,pid); } function clamp01(v){ return v<0?0:v>1?1:v; } @@ -1997,6 +2000,11 @@

} function latBuild(pid, rows){ var out={}; _latScores[pid]=out; + if(LAT_RAMP[pid]){ + var rfull=LAT_FULL[pid]||1; + rows.forEach(function(r){ out[r.fw]=100*clamp01((+r.ramp_reached||0)/rfull); }); + return; + } if(LAT_HELD[pid]){ var hc=Infinity,hm=Infinity,h5=Infinity,h9=Infinity, hfull=LAT_FULL[pid]||1; rows.forEach(function(r){ @@ -2054,6 +2062,17 @@

// exact one. Avg latency stays: it replaced p99.9 in the score and is the // queueing signal this view has to show. Dropping the other two buys the // name back ~200px and loses no information. + if(LAT_RAMP[state.profile]){ + c.push({k:'l1mscore', label:'Score', num:true, w:'92px', min:0, tip:'0-100: the connections reached before the active ones\u2019 p99 went over 2 ms, as a share of the two million the ramp opens. Higher is better.'}); + c.push({k:'reached', label:'Reached', num:true, w:'112px', min:0, tip:'Every connection opened by the last interval that held the 2 ms p99, idle ones included, whether or not the server has closed some of them since. An idle connection has to be kept 30 seconds first.'}); + c.push({k:'held', label:'Peak open', num:true, w:'112px', min:0, tip:'The most connections open at once, in any interval up to then. With a keep-alive timeout shorter than the ramp the server closes idle ones, so this is below Reached.'}); + c.push({k:'shed', label:'Closed', num:true, w:'100px', min:520, tip:'Idle connections the server had closed by then: how it sheds what it is not using.'}); + c.push({k:'cpureq', label:'CPU / req', num:true, w:'110px', min:640, tip:'CPU microseconds the server spent per request over the whole run, read exactly out of its cgroup rather than sampled.'}); + c.push({k:'mem', label:'Mem', num:true, w:'92px', min:0, tip:'The server container\u2019s peak memory across the run.'}); + c.push({k:'p50', label:'p50', num:true, w:'92px', min:820, tip:'Median latency of the active connections over the whole run, coordinated-omission corrected.'}); + c.push({k:'p99', label:'p99', num:true, w:'92px', min:0, tip:'99th-percentile latency of the active connections over the whole run. The limit the ramp is stopped at is per interval.'}); + return c.filter(function(x){ return W>=x.min; }); + } if(LAT_HELD[state.profile]){ c.push({k:'l1mscore', label:'Score', num:true, w:'92px', min:0, tip:'0-100. rateFactor \u00d7 (0.25\u00d7CPU per request + 0.25\u00d7memory + 0.25\u00d7p50 + 0.25\u00d7p99), each measured against the best in the field. rateFactor is 1 at 95% of the offered rate and falls proportionally below it. Higher is better.'}); c.push({k:'rps', label:'Requests / sec', num:true, w:'minmax(150px,1fr)', min:0, tip:TIP.rps}); @@ -2098,6 +2117,8 @@

if(k==='cpureq') return '
'+(r.cpu_per_req_us!=null?esc((+r.cpu_per_req_us).toFixed(2))+' \u00b5s':'-')+'
'; if(k==='cputot'){ var t=cpuTotPct(r,state.profile); return '
'+(t==null?'-':esc(t.toFixed(1))+'%')+'
'; } if(k==='held') return '
'+(r.connections_open!=null?fmt(+r.connections_open):'-')+'
'; + if(k==='reached') return '
'+(r.ramp_reached!=null?fmt(+r.ramp_reached):'-')+'
'; + if(k==='shed') return '
'+(r.idle_closed!=null?fmt(+r.idle_closed):'-')+'
'; if(k==='avg') return '
'+esc(r.avg_latency||'-')+'
'; if(k==='p99') return '
'+esc(r.p99_latency||'-')+'
'; if(k==='p50') return '
'+esc(r.p50_latency||'-')+'
';