summaryrefslogtreecommitdiff
path: root/ext/http/http_next.rs
AgeCommit message (Collapse)Author
2023-06-12perf(ext/http): from_maybe_shared_unchecked for header values (#19478)Matt Mastracci
Prevents re-checking strings we already know are latin-1. Small improvement: 115k->116k
2023-06-08perf: use sendto syscalls (#19414)Bartek Iwańczuk
This switches syscall used in HTTP and WS server from "writev" to "sendto". "DENO_USE_WRITEV=1" can be used to enable using "writev" syscall. Doing this for easier testing of various setups.
2023-06-06perf(http): avoid flattening http headers (#19384)Marvin Hagemeister
2023-06-03perf(ext/http): Migrate op_http_get_request_method_and_url to v8::Array (#19355)Kamil Ogórek
Tackles 3rd item from https://github.com/denoland/deno/issues/19330 list. Before: 113.9k After: 114.3k
2023-06-02perf(ext/http): Migrate op_http_get_request_headers to v8::Array (#19354)Kamil Ogórek
2023-06-02perf(ext/http): Use flat list of headers for multiple set/get methods (#19336)Kamil Ogórek
This PR attempts to resolve the first item on the list from https://github.com/denoland/deno/issues/19330 which is about using a flat list of interleaved key/value pairs, instead of a nested array of tuples. I can tackle some more if you can provide a quick example of using raw v8 arrays, cc @mmastrac
2023-06-01chore(ext/http): add env var to disable writev syscall (#19338)Bartek Iwańczuk
2023-05-30perf(ext/http): Add a sync phase to http serving (#19321)Matt Mastracci
Under heavy load, we often have requests queued up that don't need an async call to retrieve. We can use a fast path sync op to drain this set of ready requests, and then fall back to the async op once we run out of work. This is a .5-1% bump in req/s on an M2 mac. About 90% of the handlers go through this sync phase (based on a simple instrumentation that is not included in this PR) and skip the async machinery entirely.
2023-05-24feat(ext/http): Brotli Compression (#19216)Levente Kurusa
Add Brotli streaming compression to HTTP
2023-05-18feat(ext/http): Add support for trailers w/internal API (HTTP/2 only) (#19182)Matt Mastracci
Necessary for #3326. Requested in #10214 as well.
2023-05-16fix(ext/http): Ensure cancelled requests don't crash Deno.serve (#19154)Matt Mastracci
Fixes for various `Attemped to access invalid request` bugs (#19058, #15427, #17213). We did not wait for both a drop event and a completion event before removing items from the slab table. This ensures that we do so. In addition, the slab methods are refactored out into `slab.rs` for maintainability.
2023-05-16refactor(ext/http): simpler ws server in http_next (#19133)Luca Casonato
Merges `op_http_upgrade_next` and `op_ws_server_create`, significantly simplifying websocket construction in ext/http (next), and removing one JS -> Rust call. Also WS server now doesn't bypass `HttpPropertyExtractor`.
2023-05-15refactor(ext/http): generic abstract listeners (#19132)Luca Casonato
Improve abstractions around listeners to support listener + connection network stream combinations not previously possible (for example a listener exposed as a Tcp, creating Unix network streams).
2023-05-14refactor(core): bake single-thread assumptions into spawn/spawn_blocking ↵Matt Mastracci
(#19056) Partially supersedes #19016. This migrates `spawn` and `spawn_blocking` to `deno_core`, and removes the requirement for `spawn` tasks to be `Send` given our single-threaded executor. While we don't need to technically do anything w/`spawn_blocking`, this allows us to have a single `JoinHandle` type that works for both cases, and allows us to more easily experiment with alternative `spawn_blocking` implementations that do not require tokio (ie: rayon). Async ops (+~35%): Before: ``` time 1310 ms rate 763358 time 1267 ms rate 789265 time 1259 ms rate 794281 time 1266 ms rate 789889 ``` After: ``` time 956 ms rate 1046025 time 954 ms rate 1048218 time 924 ms rate 1082251 time 920 ms rate 1086956 ``` HTTP serve (+~4.4%): Before: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 68.78us 19.77us 1.43ms 86.84% Req/Sec 68.78k 5.00k 73.84k 91.58% 1381833 requests in 10.10s, 167.36MB read Requests/sec: 136823.29 Transfer/sec: 16.57MB ``` After: ``` Running 10s test @ http://localhost:4500 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 63.12us 17.43us 1.11ms 85.13% Req/Sec 71.82k 3.71k 77.02k 79.21% 1443195 requests in 10.10s, 174.79MB read Requests/sec: 142921.99 Transfer/sec: 17.31MB ``` Suggested-By: alice@ryhl.io Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-10refactor(core): http_next generic over request extractor (#19071)Matt Mastracci
2023-05-10feat(ext/http): Automatic compression for Deno.serve (#19031)Matt Mastracci
`Content-Encoding: gzip` support for `Deno.serve`. This doesn't support Brotli (`br`) yet, however it should not be difficult to add. Heuristics for compression are modelled after those in `Deno.serveHttp`. Tests are provided to ensure that the gzip compression is correct. We chunk a number of different streams (zeros, hard-to-compress data, already-gzipped data) in a number of different ways (regular, random, large/small, small/large).
2023-05-08refactor: prefix ops w/ crate they are defined in (#19044)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-05-08fix(ext/http): Ensure Deno.serve works across --watch restarts (#18998)Matt Mastracci
Fixes #16699 and #18960 by ensuring that we release our HTTP `spawn_local` tasks when the HTTP resource is dropped. Because our cancel handle was being projected from the resource via `RcMap`, the resource was never `Drop`ped. By splitting the handle out into its own `Rc`, we can avoid keeping the resource alive and let it drop to cancel everything.
2023-04-27fix(ext/http): internal upgradeHttpRaw works with "Deno.serve()" API (#18859)Matt Mastracci
Fix internal "upgradeHttpRaw" API restoring capability to upgrade HTTP connection in polyfilles "node:http" API.
2023-04-26perf(ext/http): use smi for slab IDs (#18848)Divy Srivastava
2023-04-24feat(ext/http): h2c for http/2 (#18817)Matt Mastracci
This implements HTTP/2 prior-knowledge connections, allowing clients to request HTTP/2 over plaintext or TLS-without-ALPN connections. If a client requests a specific protocol via ALPN (`h2` or `http/1.1`), however, the protocol is forced and must be used.
2023-04-23fix(ext/http): ensure that multiple upgrades and multiple simultaneous ↵Matt Mastracci
requests cannot cause a panic (#18810) Fix a bug where we weren't saving `slabId` in #18619, plus add some robustness checks around multiple upgrades (w/test).
2023-04-22feat(ext/http): Rework Deno.serve using hyper 1.0-rc3 (#18619)Matt Mastracci
This is a rewrite of the `Deno.serve` API to live on top of hyper 1.0-rc3. The code should be more maintainable long-term, and avoids some of the slower mpsc patterns that made the older code less efficient than it could have been. Missing features: - `upgradeHttp` and `upgradeHttpRaw` (`upgradeWebSocket` is available, however). - Automatic compression is unavailable on responses.