summaryrefslogtreecommitdiff
path: root/ext/websocket
AgeCommit message (Collapse)Author
2023-05-18fix(ext/websocket): order of ws writes (#19131)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/19041
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-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-12chore: forward v1.33.3 release commit to main (#19111)denobot
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED** This is the release commit being forwarded back to main for 1.33.3 Please ensure: - [x] Everything looks ok in the PR - [x] The release has been published To make edits to this PR: ```shell git fetch upstream forward_v1.33.3 && git checkout -b forward_v1.33.3 upstream/forward_v1.33.3 ``` Don't need this PR? Close it. cc @levex Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-04chore: forward v1.33.2 release commit to main (#18990)denobot
**THIS PR HAS GIT CONFLICTS THAT MUST BE RESOLVED** This is the release commit being forwarded back to main for 1.33.2 Please ensure: - [x] Everything looks ok in the PR - [x] The release has been published To make edits to this PR: ```shell git fetch upstream forward_v1.33.2 && git checkout -b forward_v1.33.2 upstream/forward_v1.33.2 ``` Don't need this PR? Close it. cc @levex Co-authored-by: levex <levex@users.noreply.github.com> Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-05-02chore: release extension crates, unpin tokio (#18954)Bartek Iwańczuk
2023-05-01perf: lazily create RootCertStore (#18938)David Sherret
2023-05-01refactor: migrate async ops to generated wrappers (#18937)Bartek Iwańczuk
Migrates some of existing async ops to generated wrappers introduced in https://github.com/denoland/deno/pull/18887. As a result "core.opAsync2" was removed. I will follow up with more PRs that migrate all the async ops to generated wrappers.
2023-05-01fix(core): Use primordials for methods (#18839)Kenta Moriuchi
I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152
2023-05-01chore(ext/websocket): readd autobahn|testsuite fuzzingclient (#18903)Divy Srivastava
This reverts commit https://github.com/denoland/deno/commit/17d1c7e444542f43229a047853605ac22081abdf. The `Deno.serve` signature update in https://github.com/denoland/deno/pull/18759 broke the testee server right after this patch landed on `main`.
2023-05-01refactor(webidl): move prefix & context out of converters options bag (#18931)Leo Kettmeir
2023-04-30perf(ext/websocket): use internal dispatch for msg events (#18904)Divy Srivastava
``` Linux divy-2 5.19.0-1022-gcp #24~22.04.1-Ubuntu SMP Sun Apr 23 09:51:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux 32GiB System memory Intel(R) Xeon(R) CPU @ 3.10GHz # main Msg/sec: 89398.250000 Msg/sec: 90079.750000 # this patch Msg/sec: 91919.750000 Msg/sec: 91762.250000 ```
2023-04-28chore: forward v1.33.1 release commit to main (#18897)denobot
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-28fix(ext/websocket): client connect URI (#18892)Divy Srivastava
2023-04-28fix(ext/websocket): restore op_ws_send_ping (#18891)Bartek Iwańczuk
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-281.33.0 (#18879)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-04-27perf(ext/websocket): various performance improvements (#18862)Bartek Iwańczuk
- No need to wrap buffer in a `new DataView()` - Deferred ops are still eagerly polled, but resolved on the next tick of the event loop, we don't want them to be eagerly polled - Using "core.opAsync"/"core.opAsync2" incurs additional cost of looking up these functions on each call. Similarly with "ops.*" --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-26Revert "chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#… ↵Bartek Iwańczuk
(#18856) …18846)" This reverts commit 036778c2e8e159ef1e586de4102f823367b7c554. Keeps failing on `main` branch.
2023-04-26chore(ext/websocket): Add autobahn|testsuite fuzzingclient (#18846)Divy Srivastava
Closes #17242
2023-04-26chore(ext/websocket): remove ping frame handling (#18847)Divy Srivastava
Automatically done in the fastwebsockets crate
2023-04-25refactor(ext/websocket): use specialized ops (#18819)Bartek Iwańczuk
Instead of relying on `op_ws_send` to send different kinds of messages, use specialized ops everywhere.
2023-04-23chore: remove tokio-tungstenite dependency (#18814)Bartek Iwańczuk
2023-04-23refactor(ext/websocket): Remove dep on tungstenite by reworking code (#18812)Matt Mastracci
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.
2023-04-22refactor: rewrite tests to "fastwebsockets" crate (#18781)Bartek Iwańczuk
Migrating off of `tokio-tungstenite` crate. --------- Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
2023-04-21fix(ext/websocket): upgrade fastwebsockets to 0.2.4 (#18791)Divy Srivastava
Fixes https://github.com/denoland/deno/issues/18775
2023-04-20refactor(ext/websocket): use fastwebsockets client (#18725)Divy Srivastava
2023-04-18chore: forward v1.32.5 release commit to main (#18758)denobot
Co-authored-by: levex <levex@users.noreply.github.com> Co-authored-by: Levente Kurusa <lkurusa@kernelstuff.org>
2023-04-14fix(core): Use safe primordials wrappers (#18687)Kenta Moriuchi
2023-04-14fix(ext/websocket): Avoid write deadlock that requires read_frame to ↵Divy Srivastava
complete (#18705) Fixes https://github.com/denoland/deno/issues/18700 Timeline of the events that lead to the bug. 1. WebSocket handshake complete 2. Server on `read_frame` holding an AsyncRefCell borrow of the WebSocket stream. 3. Client sends a TXT frame after a some time 4. Server recieves the frame and goes back to `read_frame`. 5. After some time, Server starts a `write_frame` but `read_frame` is still holding a borrow! ^--- Locked. read_frame needs to complete so we can resume the write. This commit changes all writes to directly borrow the `fastwebsocket::WebSocket` resource under the assumption that it won't affect ongoing reads.
2023-04-13chore: bump fastwebsockets to 0.1.3 (#18684)Divy Srivastava
Fixes build on aarch64 Linux. See https://github.com/littledivy/fastwebsockets/issues/2
2023-04-13perf(ext/websocket): make `op_server_ws_next_event` deferred (#18632)Divy Srivastava
Avoid attempting to read immediately, wasting time polling the future. 2% throughput improvement on Linux.
2023-04-12refactor(ext/webidl): remove object from 'requiredArguments' (#18674)Bartek Iwańczuk
This should produce a little less garbage and using an object here wasn't really required. --------- Co-authored-by: Aapo Alasuutari <aapo.alasuutari@gmail.com> Co-authored-by: Leo Kettmeir <crowlkats@toaxl.com>
2023-04-12chore: forward v1.32.4 release commit to main (#18669)denobot
Co-authored-by: levex <levex@users.noreply.github.com>
2023-04-06perf(ext/websocket): replace tokio_tungstenite server with fastwebsockets ↵Divy Srivastava
(#18587) https://github.com/littledivy/fastwebsockets ``` # This PR ./load_test 100 0.0.0.0 8080 0 0 Running benchmark now... Msg/sec: 176355.000000 # main ./load_test 100 0.0.0.0 8080 0 0 Running benchmark now... Msg/sec: 157198.750000 ```
2023-04-02chore: Turn back on dlintPreferPrimordials (#17715)Kenta Moriuchi
Closes #17709
2023-04-01chore: forward v1.32.3 release commit to main (#18561)denobot
Co-authored-by: David Sherret <dsherret@gmail.com>
2023-04-01chore: forward v1.32.2 release commit to main (#18539)denobot
This is the release commit being forwarded back to main for 1.32.2
2023-03-31perf(ext/websocket): use opAsync2 to avoid spread deopt (#18525)Divy Srivastava
This commit adds a new core API `opAsync2` to call an async op with atmost 2 arguments. Spread argument iterators has a pretty big perf hit when calling ops. | name | avg msg/sec/core | | --- | --- | | 1.32.1 | `127820.750000` | | #18506 | `140079.000000` | | #18506 + #18509 | `150104.250000` | | #18506 + #18509 + this | `157340.000000` |
2023-03-31perf(ext/websocket): efficient event kind serialization (#18509)Divy Srivastava
Use u16 to represent the kind of event (0 - 6) & event code > 6 is treated as the close code. This way we can represent all events + the close code in a single JS number. This is safe because (as per RFC 6455) close code from 0-999 are reserved & not used. | name | avg msg/sec/core | | --- | --- | | deno_main | `127820.750000` | | deno #18506 | `140079.000000` | | deno #18506 + this | `150104.250000` |
2023-03-30perf(ext/websocket): special op for sending binary data frames (#18506)Divy Srivastava
Easy perf win by avoiding deserializing `SendValue` through serde_v8. | name | avg msg/sec/core | | --- | --- | | deno_main | `127820.750000` | | deno_this | `140079.000000` |
2023-03-30perf(ext/websocket): special op for sending text data frames (#18507)Divy Srivastava
Similar to #18506 but for Text frames.
2023-03-23chore: forward v1.32.1 release commit to main (#18399)denobot
Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com> Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-221.32.0 (#18367)denobot
Bumped versions for 1.32.0 --------- Co-authored-by: mmastrac <mmastrac@users.noreply.github.com> Co-authored-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
2023-03-19chore: bump http to ^0.29.0 (#18259)Max
`http` is very stable, it's safe to "unpin" it from `=0.28.0` version. This helps embedders that depend on newer version of `http` crate.
2023-03-17perf(core) Reduce copying and cloning in extension initialization (#18252)Matt Mastracci
Follow-up to #18210: * we are passing the generated `cfg` object into the state function rather than passing individual config fields * reduce cloning dramatically by making the state_fn `FnOnce` * `take` for `ExtensionBuilder` to avoid more unnecessary copies * renamed `config` to `options`
2023-03-17feat(core) deno_core::extension! macro to simplify extension registration ↵Matt Mastracci
(#18210) This implements two macros to simplify extension registration and centralize a lot of the boilerplate as a base for future improvements: * `deno_core::ops!` registers a block of `#[op]`s, optionally with type parameters, useful for places where we share lists of ops * `deno_core::extension!` is used to register an extension, and creates two methods that can be used at runtime/snapshot generation time: `init_ops` and `init_ops_and_esm`. --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2023-03-16chore: forward v1.31.3 release commit to main (#18222)denobot
Co-authored-by: kt3k <kt3k@users.noreply.github.com>
2023-03-10chore: forward v1.31.2 release commit to main (#18114)denobot
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
2023-03-09refactor: Split extension registration for runtime and snapshotting (#18095)Bartek Iwańczuk
This commit splits "<ext_name>::init" functions into "init_ops" and "init_ops_and_esm". That way we don't have to construct list of ESM sources on each startup if we're running with a snapshot. In a follow up commit "deno_core" will be changed to not have a split between "extensions" and "extensions_with_js" - it will be embedders' responsibility to pass appropriately configured extensions. Prerequisite for https://github.com/denoland/deno/pull/18080