-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(ext/http) refer to HttpRecord directly using v8::External #20770
Conversation
@mmastrac I believe this is ready for review, let me know if anything else is needed. I recommend reviewing commit by commit since the renaming to remove the slab terminology is quite noisy. Log of serve_test with __http_tracing enabled: https://gist.github.com/lrowe/c91d41898156ddbb529a525027f29cf4 |
nice! |
Great work! This looks exactly like we discussed. Good job on the additional optimizations as well. I looked over it once and didn't see anything that looked out of place, but I'll take another pass. |
I may be able to eke out another half a percent or so of performance by pooling Ideally I'd like to get to the point where the HttpRecord lives on the service future and those futures are pooled, but I'm not sure that's quite possible without async drop since the service future might be dropped midway (e.g. on TCP connection closed) but the HttpRecord must live until the JS serve handler completes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go. Great simplifications. We'll need to run our benchmarks after landing this but I'm very positive.
064e87f
to
393d48b
Compare
…tead of through slabId.
e3442b8
to
126476c
Compare
Addressed via deno_core type-checked externals
/bench http[minimal,realistic] |
http[minimal]
http[realistic]
start: id: server: |
Reuse existing existing allocations for HttpRecord and response HeaderMap where possible. At request end used allocations are returned to the pool and the pool and the pool sized to 1/8th the current number of inflight requests. For http1 hyper will reuse the response HeaderMap for the following request on the connection. Builds upon #20770 --------- Co-authored-by: Matt Mastracci <[email protected]>
…dy completion (#20822) Use HttpRecord as response body so requests can be tracked all the way to response body completion. This allows Request properties to be accessed while the response body is streaming. Graceful shutdown now awaits a future instead of async spinning waiting for requests to finish. On the minimal benchmark this refactor improves performance an additional 2% over pooling alone for a net 3% increase over the previous deno main branch. Builds upon #20809 and #20770. --------- Co-authored-by: Matt Mastracci <[email protected]>
…20770) Makes the JavaScript Request use a v8:External opaque pointer to directly refer to the Rust HttpRecord. The HttpRecord is now reference counted. To avoid leaks the strong count is checked at request completion. Performance seems unchanged on the minimal benchmark. 118614 req/s this branch vs 118564 req/s on main, but variance between runs on my laptop is pretty high. --------- Co-authored-by: Matt Mastracci <[email protected]>
Reuse existing existing allocations for HttpRecord and response HeaderMap where possible. At request end used allocations are returned to the pool and the pool and the pool sized to 1/8th the current number of inflight requests. For http1 hyper will reuse the response HeaderMap for the following request on the connection. Builds upon #20770 --------- Co-authored-by: Matt Mastracci <[email protected]>
…dy completion (#20822) Use HttpRecord as response body so requests can be tracked all the way to response body completion. This allows Request properties to be accessed while the response body is streaming. Graceful shutdown now awaits a future instead of async spinning waiting for requests to finish. On the minimal benchmark this refactor improves performance an additional 2% over pooling alone for a net 3% increase over the previous deno main branch. Builds upon #20809 and #20770. --------- Co-authored-by: Matt Mastracci <[email protected]>
…enoland#20770) Makes the JavaScript Request use a v8:External opaque pointer to directly refer to the Rust HttpRecord. The HttpRecord is now reference counted. To avoid leaks the strong count is checked at request completion. Performance seems unchanged on the minimal benchmark. 118614 req/s this branch vs 118564 req/s on main, but variance between runs on my laptop is pretty high. --------- Co-authored-by: Matt Mastracci <[email protected]>
…#20809) Reuse existing existing allocations for HttpRecord and response HeaderMap where possible. At request end used allocations are returned to the pool and the pool and the pool sized to 1/8th the current number of inflight requests. For http1 hyper will reuse the response HeaderMap for the following request on the connection. Builds upon denoland#20770 --------- Co-authored-by: Matt Mastracci <[email protected]>
…dy completion (denoland#20822) Use HttpRecord as response body so requests can be tracked all the way to response body completion. This allows Request properties to be accessed while the response body is streaming. Graceful shutdown now awaits a future instead of async spinning waiting for requests to finish. On the minimal benchmark this refactor improves performance an additional 2% over pooling alone for a net 3% increase over the previous deno main branch. Builds upon denoland#20809 and denoland#20770. --------- Co-authored-by: Matt Mastracci <[email protected]>
Makes the JavaScript Request use a v8:External opaque pointer to directly refer to the Rust HttpRecord.
The HttpRecord is now reference counted. To avoid leaks the strong count is checked at request completion.
Performance seems unchanged on the minimal benchmark. 118614 req/s this branch vs 118564 req/s on main, but variance between runs on my laptop is pretty high.