Skip to content

Conversation

@RaghavRoy145
Copy link

@RaghavRoy145 RaghavRoy145 commented Apr 19, 2025

Motivation

Provide optional, in‑pipeline latency logging in HTTPResponsivenessServer and a straightforward way to gather end‑to‑end percentile metrics, to address apple/swift-nio#2844 (comment)

Modifications

main.swift

  • Imported Foundation for DispatchTime.
  • Added PerformanceMeasurementHandler (logs “Request handled in XX ms”) and PingHandler (/ping endpoint).
  • Extended channelInitializer and CLI with a --collect-benchmarks flag to insert these handlers only when requested.

Examples/ping-benchmarks/run_benchmarks.sh

  • New Bash script that reads the server’s logs, collects a user‑specified number of samples, uses Python/NumPy to compute p0/p25/p50/p75/p90/p99/p100, and prints a table.

Result

Users can now opt in to per‑request latency logging via --collect-benchmarks, and run a one‑step script to produce full percentile reports.

@RaghavRoy145 RaghavRoy145 marked this pull request as draft April 19, 2025 15:40
@RaghavRoy145 RaghavRoy145 force-pushed the benchmarking-for-http-responsiveness-server branch 5 times, most recently from 4bbd9df to b9565de Compare April 19, 2025 16:47
@RaghavRoy145 RaghavRoy145 changed the title Add benchmarking support and external collect_benchmarks.sh script to HttpResponsivenessServer Add benchmarking support and external run_benchmarks.sh script to HttpResponsivenessServer Apr 19, 2025
@RaghavRoy145 RaghavRoy145 marked this pull request as ready for review April 19, 2025 16:52
@RaghavRoy145 RaghavRoy145 force-pushed the benchmarking-for-http-responsiveness-server branch from b9565de to 7888097 Compare April 19, 2025 19:52
Motivation

Provide optional, in‑pipeline latency logging in HTTPResponsivenessServer and a straightforward way to gather end‑to‑end percentile metrics.
Modifications

    main.swift

        Imported Foundation for DispatchTime.
        Added PerformanceMeasurementHandler (logs “Request handled in XX ms”) and PingHandler (/ping endpoint).
        Extended channelInitializer and CLI with a --collect-benchmarks flag to insert these handlers only when requested.

    Examples/collect_benchmarks.sh

        New Bash script that reads the server’s logs, collects a user‑specified number of samples, uses Python/NumPy to compute
        p0/p25/p50/p75/p90/p99/p100, and prints a Unicode table.

Result

Users can now opt in to per‑request latency logging via --collect-benchmarks, and run a one‑step script to produce full percentile reports.
@RaghavRoy145 RaghavRoy145 force-pushed the benchmarking-for-http-responsiveness-server branch from 7888097 to 6b9f990 Compare April 19, 2025 21:43
@RaghavRoy145 RaghavRoy145 changed the title Add benchmarking support and external run_benchmarks.sh script to HttpResponsivenessServer Add simple benchmarking to HttpResponsivenessServer Apr 20, 2025
@RaghavRoy145 RaghavRoy145 force-pushed the benchmarking-for-http-responsiveness-server branch from 011b575 to c0c257b Compare April 20, 2025 10:11
@RaghavRoy145 RaghavRoy145 force-pushed the benchmarking-for-http-responsiveness-server branch from c0c257b to 5e59c8e Compare April 20, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant