Skip to content
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

Explore uWebSockets as a ws alternative #16579

Closed
4 tasks done
privatenumber opened this issue May 2, 2024 · 4 comments
Closed
4 tasks done

Explore uWebSockets as a ws alternative #16579

privatenumber opened this issue May 2, 2024 · 4 comments

Comments

@privatenumber
Copy link
Contributor

Description

I learned about https://github.com/uNetworking/uWebSockets.js which is a faster alternative to ws.

Bun uses a fork of it for WebSockets, and based on these HTTP server benchmarks, uWebSockets.js via Node is actually faster than bun.

More benchmarks: uNetworking/uWebSockets#1415

I'm not sure how much of a bottleneck ws is, but it may be worth exploring.

Suggested solution

Explore adopting uWebSockets.js

Alternative

No response

Additional context

No response

Validations

@sapphi-red
Copy link
Member

I checked uWebSockets.js and I think it has the following problems to be used in Vite:

  • lack of minor platform support: it only supports Tier 1 platforms and there aren't any fallback implementations like we have with esbuild
  • does not have a builtin way to only install the binary needed for the platform it is ran in (e.g. optionalDependencies)

Even if these problems were solved, it has a big package size even for a single platform (5MB; ws is 143kB), so it would need to improve the perf significantly to make it worth.

@rtritto
Copy link

rtritto commented Oct 22, 2024

Thanks for the checks, I opened uNetworking/uWebSockets.js#1120

Second point can be (partially) achieved with uNetworking/uWebSockets.js#1112

@sapphi-red
Copy link
Member

Closing this as I guess the WS server perf is not the bottleneck for Vite. But feel free to create a new issue if you have proved that that is a bottleneck even for some cases.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants