Matt Mastracci
084eafe508
perf(ext/http): recover memory for serve and optimize AbortController ( #23559 )
...
Max rps without a signal is unchanged, however we can drastically reduce
memory usage by not creating the signal until needed, and we can
optimize the rps in the case where the signal is created.
With a quick memory benchmark, it looks like this helps pretty
drastically with # of GCs when benchmarking w/wrk:
- 1.42.4: 1763
- canary: 1093
- this patch: 874
This branch:
```
Running 10s test @ http://localhost:8080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 87.33us 439.95us 20.68ms 99.67%
Req/Sec 66.70k 6.39k 74.11k 83.66%
1340255 requests in 10.10s, 191.73MB read
Requests/sec: 132696.90
Transfer/sec: 18.98MB
cpu: Apple M2 Pro
runtime: deno 1.43.0 (aarch64-apple-darwin)
file:///Users/matt/Documents/scripts/bench_request.js
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------------------------------------- -----------------------------
newRequest 986.5 ns/iter 1,013,682.6 (878.2 ns … 1.18 µs) 1.01 µs 1.18 µs 1.18 µs
newAbortController 18 ns/iter 55,541,104.1 (15.6 ns … 42.62 ns) 17.71 ns 25.05 ns 26.27 ns
newAbortControllerSignal 18.66 ns/iter 53,578,966.7 (16.49 ns … 32.16 ns) 18.71 ns 25.67 ns 26.39 ns
newAbortControllerSignalOnAbort 106.49 ns/iter 9,390,164.9 (97.87 ns … 120.61 ns) 108.6 ns 114.24 ns 115.89 ns
newAbortControllerSignalAddEventListener 86.92 ns/iter 11,504,880.2 (81.88 ns … 103.15 ns) 90 ns 98.28 ns 99.55 ns
newAbortControllerSignalOnAbortNoListener 3.01 µs/iter 331,964.4 (2.97 µs … 3.1 µs) 3.06 µs 3.1 µs 3.1 µs
newAbortControllerSignalOnAbortAbort 3.26 µs/iter 306,662.6 (3.22 µs … 3.36 µs) 3.27 µs 3.36 µs 3.36 µs
```
Latest canary:
```
Running 10s test @ http://localhost:8080/
2 threads and 10 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 72.86us 71.23us 4.47ms 99.05%
Req/Sec 64.66k 5.54k 72.48k 82.18%
1299015 requests in 10.10s, 185.83MB read
Requests/sec: 128616.02
Transfer/sec: 18.40MB
cpu: Apple M2 Pro
runtime: deno 1.43.0+bc4aa5f (aarch64-apple-darwin)
file:///Users/matt/Documents/scripts/bench_request.js
benchmark time (avg) iter/s (min … max) p75 p99 p995
----------------------------------------------------------------------------------------------- -----------------------------
newRequest 1.25 µs/iter 800,005.2 (1.01 µs … 4.18 µs) 1.16 µs 4.18 µs 4.18 µs
newAbortController 18.56 ns/iter 53,868,204.3 (16.04 ns … 38.73 ns) 18.38 ns 26.1 ns 26.63 ns
newAbortControllerSignal 18.72 ns/iter 53,430,746.1 (16.13 ns … 36.71 ns) 18.71 ns 26.19 ns 26.98 ns
newAbortControllerSignalOnAbort 193.91 ns/iter 5,156,992.4 (184.25 ns … 211.41 ns) 194.96 ns 207.87 ns 209.4 ns
newAbortControllerSignalAddEventListener 171.45 ns/iter 5,832,569.2 (153 ns … 182.03 ns) 176.17 ns 180.75 ns 181.05 ns
newAbortControllerSignalOnAbortNoListener 3.07 µs/iter 326,263.3 (2.98 µs … 3.17 µs) 3.08 µs 3.17 µs 3.17 µs
newAbortControllerSignalOnAbortAbort 3.32 µs/iter 301,344.6 (3.29 µs … 3.4 µs) 3.33 µs 3.4 µs 3.4 µs
```
2024-04-25 14:52:24 -04:00
denobot
8321106b78
1.43.0 ( #23549 )
...
Bumped versions for 1.43.0
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-25 15:14:26 +05:30
Divy Srivastava
e98862deb2
perf(ext/http): cache abort signal error ( #23548 )
...
Fixes a perf regression introduced in
eed2598e6c
([flamegraph](https://profiler.firefox.com/public/83whz7mrfkshk5q6hd6hjmrmw8tgmw67s96m4p0/flame-graph/?globalTrackOrder=0&hiddenLocalTracksByPid=12691-0we&symbolServer=http%3A%2F%2F127.0.0.1%3A3000%2F316cvciry38ippl9i74fmcxrd5q9asfrr28xp02&thread=0&v=10 ))
this patch:
```
Summary:
Success rate: 100.00%
Total: 10.0007 secs
Slowest: 0.0145 secs
Fastest: 0.0001 secs
Average: 0.0006 secs
Requests/sec: 80341.4816
Total data: 9.19 MiB
Size/request: 12
Size/sec: 941.44 KiB
```
main:
```
Summary:
Success rate: 100.00%
Total: 10.0007 secs
Slowest: 0.0068 secs
Fastest: 0.0002 secs
Average: 0.0009 secs
Requests/sec: 56560.0551
Total data: 6.47 MiB
Size/request: 12
Size/sec: 662.75 KiB
```
2024-04-25 09:20:01 +02:00
Matt Mastracci
2f8825a935
feat: Add deno serve
subcommand ( #23511 )
...
By default, `deno serve` will assign port 8000 (like `Deno.serve`).
Users may choose a different port using `--port`.
`deno serve /tmp/file.ts`
`server.ts`:
```ts
export default {
fetch(req) {
return new Response("hello world!\n");
},
};
```
2024-04-24 19:45:49 +00:00
Matt Mastracci
eed2598e6c
feat(ext/http): Implement request.signal for Deno.serve ( #23425 )
...
When the response has been successfully send, we abort the
`Request.signal` property to indicate that all resources associated with
this transaction may be torn down.
2024-04-24 14:03:37 -04:00
Matt Mastracci
9425dce6db
refactor(ext/http): extract 02_websocket.ts from 01_http.js ( #23460 )
...
Landing part of https://github.com/denoland/deno/pull/21903
This will allow us to more easily refactor `serveHttp` to live on top of
`serve` by splitting the websocket code out. There's probably a lot more
we could do here but this helps.
2024-04-19 20:02:39 -06:00
Matt Mastracci
365e1f48f7
feat(ext/http): Add addr
to HttpServer ( #23442 )
...
Adds an `addr` field to `HttpServer` to simplify the pattern
`Deno.serve({ onListen({ port } => listenPort = port })`. This becomes:
`const server = Deno.serve({}); port = server.addr.port`.
Changes:
- Refactors `serve` overloads to split TLS out (in preparation for
landing a place for the TLS SNI information)
- Adds an `addr` field to `HttpServer` that matches the `addr` field of
the corresponding `Deno.Listener`s.
2024-04-19 18:09:50 -06:00
Matt Mastracci
d9d3f81f29
chore: remove unused, unstable 'http' namespace ( #23436 )
...
Landing parts of #21903 in preparation for the removal of serveHttp.
2024-04-18 11:21:25 -06:00
Bartek Iwańczuk
0a7f46b8c2
chore: forward v1.42.4 commit to main
( #23394 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-16 02:41:59 +00:00
denobot
c92f118652
chore: forward v1.42.3 release commit to main ( #23335 )
...
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-04-12 04:19:46 +00:00
denobot
ca7432b86b
chore: forward v1.42.2 release commit to main ( #23315 )
...
Co-authored-by: Satya Rohith <me@satyarohith.com>
2024-04-11 13:37:24 +05:30
林炳权
9304126be5
chore: update to Rust 1.77.2 ( #23262 )
...
update to Rust 1.77.2
---------
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-04-10 22:08:23 +00:00
Matt Mastracci
47061a4539
feat(ext/net): Refactor TCP socket listeners for future clustering mode ( #23037 )
...
Changes:
- Implements a TCP socket listener that will allow for round-robin
load-balancing in-process.
- Cleans up the raw networking code to make it easier to work with.
2024-04-08 16:18:14 -06:00
Bartek Iwańczuk
d3b63bb315
fix(ext/http): Make Deno.serveHttp()
work when proxying ( #23269 )
...
Closes https://github.com/denoland/deno/issues/21900
2024-04-08 15:02:49 -06:00
Matt Mastracci
cb12a93503
refactor(ext/tls): use cppgc to deduplicate the tls key loading code ( #23289 )
...
Pass the certificates and key files as CPPGC objects.
Towards #23233
2024-04-08 15:01:02 -06:00
denobot
8d158058e5
chore: forward v1.42.1 release commit to main ( #23162 )
...
This is the release commit being forwarded back to main for 1.42.1
Co-authored-by: littledivy <littledivy@users.noreply.github.com>
2024-04-01 13:35:46 +05:30
denobot
9c6eca1064
1.42.0 ( #23105 )
...
Bumped versions for 1.42.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-03-28 01:47:33 +01:00
Nathan Whitaker
85116226b3
chore: Forward 1.41.3 release commit ( #22930 )
...
Forward 1.41.3 release commit
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: nathanwhit <nathanwhit@users.noreply.github.com>
2024-03-14 21:23:24 +00:00
denobot
44da066359
chore: forward v1.41.2 release commit to main ( #22793 )
...
This is the release commit being forwarded back to main for 1.41.2
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-03-08 09:12:36 +00:00
cui fliter
d4b3b39cc0
chore: fix typos ( #22677 )
2024-03-04 14:28:57 +00:00
denobot
404422519c
chore: forward v1.41.1 release commit to main ( #22643 )
...
Co-authored-by: dsherret <dsherret@users.noreply.github.com>
2024-02-29 20:56:08 -05:00
denobot
118445103b
1.41.0 ( #22524 )
...
Bumped versions for 1.41.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-02-22 02:44:05 +01:00
denobot
7d47a85b57
chore: forward v1.40.5 release commit to main ( #22424 )
...
This is the release commit being forwarded back to main for 1.40.5
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-15 12:15:36 +05:30
denobot
ed34429a5f
chore: forward v1.40.4 release commit to main ( #22345 )
...
This is the release commit being forwarded back to main for 1.40.4
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-02-08 12:39:39 +00:00
Matt Mastracci
2c621f5894
refactor(cli): Move op descriptions into Rust and prepare for op import ( #22271 )
...
This moves the op sanitizer descriptions into Rust code and prepares for
eventual op import from `ext:core/ops`. We cannot import these ops from
`ext:core/ops` as the testing infrastructure ops are not always present.
Changes:
- Op descriptions live in `cli` code and are currently accessible via an
op for the older sanitizer code
- `phf` dep moved to workspace root so we can use it here
- `ops.op_XXX` changed to to `op_XXX` to prepare for op imports later
on.
2024-02-05 20:26:59 +00:00
Divy Srivastava
ca11536f3f
chore: forward v1.40.3 release commit to main ( #22220 )
...
This is the release commit being forwarded back to main for 1.40.3
Ref https://github.com/denoland/deno/pull/22219
2024-02-01 18:11:35 +09:00
Bartek Iwańczuk
462ce14a78
refactor: migrate extensions to virtual ops module ( #22135 )
...
First pass of migrating away from `Deno.core.ensureFastOps()`.
A few "tricky" ones have been left for a follow up.
2024-01-26 23:46:46 +01:00
Bartek Iwańczuk
942fb5e038
chore: upgrade deno_core ( #22124 )
...
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2024-01-26 14:04:07 -05:00
Bartek Iwańczuk
9ed713153c
chore: forward v1.40.2 commit to main ( #22133 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-26 18:59:16 +00:00
Matt Mastracci
c66f7b6d8d
fix(ext/http): smarter handling of Accept-Encoding ( #22130 )
2024-01-26 15:33:55 +00:00
Bartek Iwańczuk
d4153bb117
chore: forward v1.40.1 commit to main ( #22107 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-25 16:24:11 +00:00
denobot
9e575a2862
1.40.0 ( #22096 )
...
Bumped versions for 1.40.0
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-25 03:48:50 +01:00
Bartek Iwańczuk
174bb70eda
fix: don't use public rid accessors in internal APIs ( #22091 )
...
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-01-25 00:45:19 +01:00
Bartek Iwańczuk
71551c80a1
feat(unstable): remove Deno.upgradeHttp API ( #21856 )
...
Closes https://github.com/denoland/deno/issues/21828 .
This API is a huge footgun. And given that "Deno.serveHttp" is a
deprecated API that is discouraged to use (use "Deno.serve()"
instead); it makes no sense to keep this API around.
This is a step towards fully migrating to Hyper 1.
2024-01-22 21:35:39 +00:00
denobot
248fb9c946
chore: forward v1.39.4 release commit to main ( #21933 )
...
Co-authored-by: David Sherret <dsherret@gmail.com>
2024-01-13 20:32:50 -05:00
Bartek Iwańczuk
288774c5ed
chore: forward v1.39.3 to main ( #21915 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2024-01-12 19:13:18 +00:00
Kenta Moriuchi
515a34b4de
refactor: use core.ensureFastOps()
( #21888 )
2024-01-10 15:37:25 -07:00
Bartek Iwańczuk
cd43d2b877
chore: upgrade deno_core to 0.244.0 ( #21859 )
2024-01-09 17:25:10 +01:00
Bartek Iwańczuk
aadcd64065
chore: forward v1.39.2 release commit to main ( #21793 )
2024-01-04 23:52:17 +00:00
Kenta Moriuchi
b2cd254c35
fix: strict type check for cross realms ( #21669 )
...
Deno v1.39 introduces `vm.runInNewContext`. This may cause problems when
using `Object.prototype.isPrototypeOf` to check built-in types.
```js
import vm from "node:vm";
const err = new Error();
const crossErr = vm.runInNewContext(`new Error()`);
console.assert( !(crossErr instanceof Error) );
console.assert( Object.getPrototypeOf(err) !== Object.getPrototypeOf(crossErr) );
```
This PR changes to check using internal slots solves them.
---
current:
```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error {}
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
Date {}
```
this PR:
```
> import vm from "node:vm";
undefined
> vm.runInNewContext(`new Error("message")`)
Error: message
at <anonymous>:1:1
> vm.runInNewContext(`new Date("2018-12-10T02:26:59.002Z")`)
2018-12-10T02:26:59.002Z
```
---------
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-01-04 09:42:38 +05:30
David Sherret
7e72f3af61
chore: update copyright to 2024 ( #21753 )
2024-01-01 19:58:21 +00:00
Bartek Iwańczuk
c2414db1f6
refactor: simplify hyper, http, h2 deps ( #21715 )
...
Main change is that:
- "hyper" has been renamed to "hyper_v014" to signal that it's legacy
- "hyper1" has been renamed to "hyper" and should be the default
2023-12-27 11:59:57 -05:00
Bartek Iwańczuk
33acd437f5
refactor: finish test_util server cleanup, simplify dependencies ( #21714 )
...
Closes https://github.com/denoland/deno/issues/21578
2023-12-27 14:38:44 +01:00
Matt Mastracci
0efe438f7c
perf: remove opAsync ( #21690 )
...
`opAsync` requires a lookup by name on each async call. This is a
mechanical translation of all opAsync calls to ensureFastOps.
The `opAsync` API on Deno.core will be removed at a later time.
2023-12-27 02:30:26 +01:00
Bartek Iwańczuk
e1bfb29868
refactor: use hyper 1.0 in grpc test server ( #21584 )
...
Ref https://github.com/denoland/deno/issues/21578
2023-12-24 14:14:29 +01:00
Matt Mastracci
1297c9a8f3
chore(ext/node): use BufView natively in http2 ( #21688 )
...
Node HTTP/2 was using the default h2 `Bytes` datatype when we can be
making using of `BufView` like we do in `Deno.serve`.
`fetch` and `Deno.serverHttp` can't make use of `BufView` because they
are using `reqwest` which is stuck on hyper 0.x at this time.
2023-12-23 08:58:20 -07:00
Bartek Iwańczuk
f86456fc26
chore: update ext/http to hyper 1.0.1 and http 1.0 ( #21588 )
...
Closes https://github.com/denoland/deno/issues/21583 .
2023-12-22 01:54:28 +01:00
Bartek Iwańczuk
760af934d9
chore: forward v1.39.1 commit to main ( #21667 ) ( #21671 )
...
Co-authored-by: denobot <33910674+denobot@users.noreply.github.com>
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
2023-12-21 18:43:52 +00:00
Bartek Iwańczuk
c481ff7d81
refactor(ext/http): fork fly_accept_encodings crate ( #21586 )
...
Blocks update to Hyper 1.0. It's a really small library, no need to pull
it as a dependency.
Blocker for #21583
2023-12-14 18:43:33 +00:00
denobot
04ba8df711
1.39.0 ( #21560 )
...
Bumped versions for 1.39.0
Please ensure:
- [x] Target branch is correct (`vX.XX` if a patch release, `main` if
minor)
- [x] Crate versions are bumped correctly
- [x] deno_std version is incremented in the code (see
`cli/deno_std.rs`)
- [x] Releases.md is updated correctly (think relevancy and remove
reverts)
To make edits to this PR:
```shell
git fetch upstream release_1_39.0 && git checkout -b release_1_39.0 upstream/release_1_39.0
```
cc @mmastrac
---------
Co-authored-by: mmastrac <mmastrac@users.noreply.github.com>
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
2023-12-13 13:24:13 -07:00