Skip to content

Setup Benchmarks - #948

Open
nerdsupremacist wants to merge 8 commits into
swift-server:mainfrom
nerdsupremacist:mq-benchmarks
Open

nerdsupremacist wants to merge 8 commits into
swift-server:mainfrom
nerdsupremacist:mq-benchmarks

Conversation

@nerdsupremacist

Copy link
Copy Markdown
Member

Motivation

To improve the performance of AHC, it would be great to setup a set of E2E benchmarks we can run to track performance and avoid regressions.

Modifications

  1. Adds a simple HTTP Server we can ping during our benchmarks
  2. Adds a Benchmark package using the benchmark plugin like in our other repos
  3. Tests upload, download, and echo, as well as the new connection case
  4. The server is meant to be running in a separate process to avoid contaminating the results, so there's some helper scripts in there to make sure the server is running while the benchmarks run
  5. Setup GH actions to make sure we catch regressions in time

I highly encourage input and suggestions when it comes to the concrete benchmark setup, this is meant to just get the ball rolling with some setup.

  • Are 10 iterations too few (cause it can be a bit slow)?
  • Do wall clock and cpu time make sense?
  • I really wanted to track sys calls since I am not sure how reliable delays from context switching and sys calls actually makes it to the cpu and wall clock metrics, and sys calls can account for a lot more time

Result

==========
Benchmarks
==========

Download512B
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Context switches (K)     │        10 │        10 │        10 │        10 │        10 │        10 │        10 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Instructions (K) *       │      1345 │      1346 │      1347 │      1348 │      1350 │      1350 │      1350 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Malloc (total) *         │       181 │       181 │       181 │       181 │       183 │       183 │       183 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (total) *       │        39 │        39 │        39 │        39 │        40 │        40 │        40 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (write) *       │         0 │         0 │         0 │         0 │         0 │         0 │         0 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (total CPU) (μs) *  │       144 │       145 │       145 │       146 │       147 │       159 │       159 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (μs) * │       131 │       132 │       133 │       134 │       135 │       147 │       147 │        10 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

Echo512B
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Context switches (K)     │        15 │        15 │        15 │        15 │        15 │        15 │        15 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Instructions (K) *       │      1863 │      1864 │      1865 │      1869 │      1871 │      1871 │      1871 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Malloc (total) *         │       249 │       249 │       250 │       250 │       251 │       251 │       251 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (total) *       │        50 │        50 │        50 │        50 │        50 │        50 │        50 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (write) *       │         0 │         0 │         0 │         0 │         0 │         0 │         0 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (total CPU) (μs) *  │       200 │       201 │       202 │       203 │       205 │       205 │       205 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (μs) * │       226 │       227 │       227 │       230 │       231 │       232 │       232 │        10 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

NewConnection
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Context switches (K)     │        27 │        27 │        28 │        28 │        28 │        29 │        29 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Instructions (M) *       │        11 │        11 │        11 │        11 │        11 │        12 │        12 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Malloc (total) *         │      1564 │      1565 │      1565 │      1565 │      1565 │      1565 │      1565 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (total) *       │       138 │       138 │       138 │       139 │       139 │       139 │       139 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (write) *       │         0 │         0 │         0 │         0 │         0 │         0 │         0 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (total CPU) (μs) *  │       937 │       946 │       952 │       962 │       962 │       999 │       999 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (μs) * │       838 │       847 │       855 │       860 │       861 │       896 │       896 │        10 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

Upload250B
╒══════════════════════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╤═══════════╕
│ Metric                   │        p0 │       p25 │       p50 │       p75 │       p90 │       p99 │      p100 │   Samples │
╞══════════════════════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╪═══════════╡
│ Context switches (K)     │        15 │        15 │        15 │        15 │        15 │        15 │        15 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Instructions (K) *       │      1789 │      1790 │      1791 │      1798 │      1798 │      1798 │      1798 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Malloc (total) *         │       237 │       237 │       237 │       238 │       239 │       239 │       239 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (total) *       │        50 │        50 │        50 │        50 │        50 │        50 │        50 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Syscalls (write) *       │         0 │         0 │         0 │         0 │         0 │         0 │         0 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (total CPU) (μs) *  │       193 │       194 │       194 │       196 │       196 │       196 │       196 │        10 │
├──────────────────────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┼───────────┤
│ Time (wall clock) (μs) * │       184 │       184 │       185 │       186 │       186 │       187 │       187 │        10 │
╘══════════════════════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╧═══════════╛

@nerdsupremacist nerdsupremacist added the semver/none No version bump required. label Nov 3, 2026

This branch has not been deployed

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

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant