uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.76k stars 563 forks source link

KTLS #945

Closed grijjly closed 1 year ago

grijjly commented 1 year ago

althought main idea of this project is performance, ktls and sendfile does not exist on node side, i do not think that setsocketopt for rx and tx which is two line of code should not be hard, please add them :(

uNetworkingAB commented 1 year ago

uWS is older than KTLS, esp. if you think of any widespread kernel releases with support. If we want to add it, it should be as part of the io_uring feature which is also Linux only

civilianatpoint commented 1 year ago

freebsd has also ktls with async sendfile support, but it would be awesome to add that feature to boost performance to this library since this library created for performance, thank you for information

uNetworkingAB commented 1 year ago

We don't support Freebsd and KTLS is definitely not 2 lines of code. There is also little use for further optimization of a JS plugin that already has been measured to perform for small messages with TLS, 7x better than Node.js, where the majority of perf. loss is not from any low level feature but from the JS runtime itself.

Sure, if you plan to send huge files over HTTPS with uWS, it can perform with less than ideal performance but for anything small message (like websocket traffic) it performs very good.

uasan commented 1 year ago

Sure, if you plan to send huge files over HTTPS with uWS, it can perform with less than ideal performance but for anything small message (like websocket traffic) it performs very good.

You are right, there is a great performance in small messages now.

But from personal experience, projects are developing and often initially there are no requirements to send large responses, but sooner or later the business comes up with a functionality where you need to send a large response.

Now, you have to do it with Node.js streams, the speed is trash, you are not to blame for this, but the sendfile is really missing.

uNetworkingAB commented 1 year ago

There's no plan to take on further scope - if Node.js sucks in perf. then move to Bun, they use sendfile.