Repository navigation
feat(xpp/bench): echo server benchmark harness + Go comparison - #89
Merged
Merged
Conversation
Add libxpp/bench with a wrk-driven echo server harness: - http/echo_server.cpp — xpp::http::Server echo server (/ping, /echo?size=N, POST /echo) for wrk, built under X_BUILD_BENCHMARKS. - http/echo_server.go — route-for-route Go net/http counterpart for direct comparison. - http/README.md — benchmark baseline: xpp single-core beats Go multi-core (77.9k vs 72.9k QPS at ~1/2.4 the CPU), Go gains nothing from extra cores in keep-alive small-request workloads, xpp is the only impl with zero socket errors at 2000 connections. Record the two follow-up optimizations surfaced by the harness as todos: per-request allocation reduction in the HTTP server, and the O(n) linear router match → segment trie.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
补一个 xpp::http::Server 的端到端压测入口(wrk 驱动),并放一个 Go net/http
同路由对照版,量化单核效率与封装开销。
改动
libxpp/bench/http/echo_server.cpp:xpp echo server(GET /ping、GET /echo?size=N、POST /echo),X_BUILD_BENCHMARKS门控(
libxpp/CMakeLists.txt加add_subdirectory(bench))。libxpp/bench/http/echo_server.go:Go 对照版(route-for-route)。libxpp/bench/http/README.md:基准存档——完整数据表 + 结论。压测结论(macOS M3,wrk 4.2.0)
无 socket errors 的实现
libx/bench,PR fix(xhttp): rewrite libx bench servers on current API + h2 on_data arg fix #88)85.4k → xpp 封装开销约 10%附带的 todo(压测暴露的优化方向)
todos/http-server-per-request-allocations.md:xpp server 每请求 ~7 次堆分配todos/router-o-n-match-to-trie.md:Router 查找 O(n) 线性扫描 → segment 前缀树