Conversation
mitata-based benchmarks for httpxy server, proxyFetch, fast-proxy, @fastify/http-proxy, and http-proxy-3 with pre-bench validation.
1. Default keep-alive agents (http/https) with 256 maxSockets for connection reuse — skipped for HTTP/2 incoming requests. 2. LRU URL parse cache (256 entries) avoids repeated `new URL()` for the same string targets in server.ts, fetch.ts, and parseAddr. 3. Single header copy in `setupOutgoing` — merge req.headers and options.headers in one pass instead of two spread operations. httpxy server is now on par with fast-proxy (~50µs/req vs ~43µs GET).
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #124 +/- ##
==========================================
- Coverage 95.74% 94.87% -0.87%
==========================================
Files 8 8
Lines 752 800 +48
Branches 303 326 +23
==========================================
+ Hits 720 759 +39
- Misses 30 38 +8
- Partials 2 3 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Default keep-alive agents (http/https) for connection reuse in proxyFetch - Sync _toBuffer fast path avoids async overhead for string/ArrayBuffer bodies - Response headers built from rawHeaders array pairs instead of Headers object - Request headers: fast path for plain object (Object.assign) skipping Headers API proxyFetch: ~170µs -> ~57µs GET, ~165µs -> ~55µs POST 1KB (3x faster)
http.Agent/https.AgentwithkeepAlive: true, 256 maxSockets for connection reuse in bothProxyServerandproxyFetch. Skipped for HTTP/2 incoming requests.parseURL()with 256-entry LRU avoids repeatednew URL()for the same string targets.setupOutgoingmergesreq.headers+options.headersin one pass instead of two spreads.proxyFetchoptimizations — sync_toBufferfast path, response headers fromrawHeaderspairs instead ofHeadersobject, plain-object header fast path viaObject.assign.bench/index.tswith validation + mitata benchmarks.Results
Before → After
Acknowledgements
Performance optimizations were inspired by analysis of fast-proxy and @fastify/http-proxy.