Switch benchmarks to real HTTP roundtrips against a localhost WSGI server#959
Switch benchmarks to real HTTP roundtrips against a localhost WSGI server#959Kludex wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ae46818f2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| class _SilentHandler(WSGIRequestHandler): | ||
| def log_message(self, format: str, *args: Any) -> None: |
There was a problem hiding this comment.
Enable HTTP/1.1 for keep-alive benchmark server
_SilentHandler inherits WSGIRequestHandler without overriding protocol_version, so the benchmark server responds as HTTP/1.0 (connection closed after each response). In this setup, test_bench_client_keepalive_burst cannot actually exercise a kept-alive connection, and the other client benchmarks also include reconnect overhead rather than stable connection reuse, which invalidates the transport/pooling signal this commit is trying to measure.
Useful? React with 👍 / 👎.
Merging this PR will degrade performance by 92.57%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Summary
httpcore2._backends.httpx2.Clientagainst it. The whole stack runs - Client, Transport, connection pool, real sockets - so any optimisation along that path now produces a measurable signal.Benchmarks
test_bench_url_parse_and_join- pure CPU, URL parse + join regression canary.test_bench_request_build_json- request construction + JSON encode.test_bench_client_get_json- GET a moderate JSON response from the real server.test_bench_client_post_large- POST 4MB through the full client (exercises socket write).test_bench_client_stream_download- stream 4MB from the server (exercises socket read).test_bench_client_keepalive_burst- 64 sequential GETs over a kept-alive connection.Test plan
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.