1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
denoland-deno/ext
Nathan Whitaker e92a05b551
feat(serve): Opt-in parallelism for deno serve (#24920)
Adds a `parallel` flag to `deno serve`. When present, we spawn multiple
workers to parallelize serving requests.


```bash
deno serve --parallel main.ts
```

Currently on linux we use `SO_REUSEPORT` and rely on the fact that the
kernel will distribute connections in a round-robin manner.

On mac and windows, we sort of emulate this by cloning the underlying
file descriptor and passing a handle to each worker. The connections
will not be guaranteed to be fairly distributed (and in practice almost
certainly won't be), but the distribution is still spread enough to
provide a significant performance increase.

---
(Run on an Macbook Pro with an M3 Max, serving `deno.com`

baseline::
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   239.78ms   13.56ms 330.54ms   79.12%
    Req/Sec   258.58     35.56   360.00     70.64%
  Latency Distribution
     50%  236.72ms
     75%  248.46ms
     90%  256.84ms
     99%  268.23ms
  15458 requests in 30.02s, 2.47GB read
Requests/sec:    514.89
Transfer/sec:     84.33MB
```

this PR (`with --parallel` flag)
```
❯ wrk -d 30s -c 125 --latency http://127.0.0.1:8000
Running 30s test @ http://127.0.0.1:8000
  2 threads and 125 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   117.40ms  142.84ms 590.45ms   79.07%
    Req/Sec     1.33k   175.19     1.77k    69.00%
  Latency Distribution
     50%   22.34ms
     75%  223.67ms
     90%  357.32ms
     99%  460.50ms
  79636 requests in 30.07s, 12.74GB read
Requests/sec:   2647.96
Transfer/sec:    433.71MB
```
2024-08-14 22:26:21 +00:00
..
broadcast_channel chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
cache chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
canvas docs(ext/canvas): document public Canvas APIs (#24895) 2024-08-06 13:45:16 +09:00
console fix(ext/console): render properties of Intl.Locale (#24827) 2024-08-01 09:45:05 -07:00
cron chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
crypto chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
fetch fix(ext/fetch): include TCP src/dst socket info in error messages (#24939) 2024-08-08 08:47:15 -07:00
ffi chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
fs chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
http feat(serve): Opt-in parallelism for deno serve (#24920) 2024-08-14 22:26:21 +00:00
io chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
kv chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
napi chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
net feat(serve): Opt-in parallelism for deno serve (#24920) 2024-08-14 22:26:21 +00:00
node feat(ext/node): support http2session.socket (#24786) 2024-08-14 21:59:22 +00:00
node_resolver feat: upgrade V8 to 12.8 (#24693) 2024-07-31 23:22:34 +00:00
tls chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
url fix(urlpattern): correct typings for added APIs (#24881) 2024-08-05 07:21:57 -07:00
web docs: improve TextDecoder and TextEncoder jsdoc (#24890) 2024-08-06 09:56:54 +02:00
webgpu fix(webgpu): Fix GPUAdapter#isFallbackAdapter and GPUAdapter#info properties (#24914) 2024-08-07 02:17:33 -07:00
webidl feat(fetch): accept async iterables for body (#24623) 2024-08-06 00:13:02 -07:00
websocket chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00
webstorage chore: forward v1.45.5 release commit to main (#24818) 2024-07-31 15:14:27 -07:00