v20.25.0 #904
Replies: 6 comments 15 replies
-
This is an experimental mode that does not honor the AsyncHooks feature of Node.js, for uWS callbacks. That's where all the performance gain comes from - by not having to pay for the Node.js "always pay, regardless if used" way of implementing said AsyncHooks. Everything in Node.js pays for this overhead, always, regardless if used or not. You see, Node.js is optimized to have a fast slow path and a slow fast path, rather than a fast fast path and a slow slow path. It makes sense, when you don't make sense. Similar to EXPERIMENTAL_FASTCALL (now removed) but not as broken. |
Beta Was this translation helpful? Give feedback.
-
Are there any breaking API changes to consider or is it enough to set |
Beta Was this translation helpful? Give feedback.
-
Hey, I added support for
I am assuming it is because pushing to the Readable and then the Readable eventually emitting the data event to the consumer(s) had too many iterations in it to the point where the event loops become out of sync and the Buffer gets de-allocated by uWS before the stream can even emit the buffer. The reason I was doing this in the first place was because I would actually pre-allocate an empty Buffer for the whole body and then simply copy the incoming But regardless, everything else seems to work fine with all tests passing and I think the performance gains should be worth it even though the new implementation always copying buffers into memory will result in higher memory usage and more work for the garbage collector over time. |
Beta Was this translation helpful? Give feedback.
-
Why do you need Readable streams, for such a simple task, we use this async method: const readBody = (request, response) =>
new Promise((resolve, reject) => {
let offset = 0;
const buffer = new Uint8Array(+request.getHeader('content-length'));
response.onAborted = reject;
response.onData((chunk, done) => {
buffer.set(chunk, offset);
if (done) {
resolve(buffer);
} else {
offset += chunk.byteLength;
}
});
}); |
Beta Was this translation helpful? Give feedback.
-
Oh boy.. uWebSockets.js is getting closer to raw uWebSockets huh 🎉 I don't know if you wanted tests on macOS yet, but I'm seeing considerable lower performance with This is a simple test with node v20.2 and uWebSockets.js v20.25.0
// uws.js
import uWS from 'uWebSockets.js'
uWS.App()
.get('/*', (res, req) => res.end('OK'))
.listen(9000, () => console.log('listening')) I'm also seeing
when exiting the node process using |
Beta Was this translation helpful? Give feedback.
-
I keep getting this error if I use
I use socket.io with uWS integration. |
Beta Was this translation helpful? Give feedback.
-
Alien tech 👾
This release introduces a new mode of integration; no integration. Setting the environment variable ALIEN_UWS=1 makes uWS run entirely alien ("disjoint") to Node.js, on its own separate event-loop. This mode increases performance of uWS.js given the same CPU-time budget, by avoiding Node.js's heavy weight way of delivering events to the script.
This kind of integration is a prerequisite for the future potential swap to io_uring. So please test this mode. Test it in all kinds of debug modes and weird set ups. Try to break it.
This discussion was created from the release v20.25.0.
Beta Was this translation helpful? Give feedback.
All reactions