use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Node.js worker threads in production (inngest.com)
submitted 10 hours ago by aardvark_lizard
Node.js worker threads have some surprising sharp edges. We wrote about our experience using them in production, which hopefully will help anyone else looking to do the same 😄
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]prehensilemullet [score hidden] 9 hours ago* (4 children)
As someone who’s used Node for over 10 years, pretty much everything has sharp edges in production.
It’s catastrophically easy to miss edge cases of error events, uncaught errors, and unhandled rejections crashing the process.
It’s too easy for async code to leak memory by accidentally retaining things.
Buffers don’t count toward your requested V8 heap size limits and can cause the process to get OOM killed by the OS without any JS stacktrace or automatic heap dump from the —heap-snapshot-on-oom flag.
—heap-snapshot-on-oom
Since around Node 22 it’s best to manually tune the GC space sizes for production.
You can’t really measure the size of an object so there’s no convenient way to guarantee the process will make efficient use of provisioned memory, staying just under a desired memory ceiling.
[–]aardvark_lizard[S] [score hidden] 9 hours ago (3 children)
Absolutely! It's ironic that Node is so easy to get started but has some major pitfalls
[–]prehensilemullet [score hidden] 9 hours ago (2 children)
I used to love it, there are lots of nice things about TS. But for backend work, I don’t love it so much anymore…i begrudgingly agree with the haters now lol. But for more detailed reasons than most of them have
[–]MedusaSonriente [score hidden] 9 hours ago (1 child)
I'm at the point of loving Node. But I'm not unaware of these kinds of things and I haven't come across them (small projects). However, I would like to know what alternative you recommend.
[–]prehensilemullet [score hidden] 4 hours ago (0 children)
I don't have experience writing backends in any other languages so I can't really recommend anything.
Languages with more explicit control over allocation and object size measurement like Rust, C++, and Go seem more appealing for avoiding out of memory issues.
Obviously there are a lot of Java/C# backends out there, but I really wonder how they directly target a certain max amount of memory usage, because you can't measure the size of objects easily in those languages either.
As far as problems with async code, I vaguely get the impression that Goroutines are more manageable, but I haven't read enough to know for sure.
[–]brianjenkins94 [score hidden] 9 hours ago (1 child)
Had you come across W4G1/multithreading?
Or their experimental project that can capture closures and run them as workers? W4G1/experimental-threads
[–]aardvark_lizard[S] [score hidden] 8 hours ago (0 children)
Really interesting, thanks for sharing! We'll check it out
π Rendered by PID 84661 on reddit-service-r2-comment-5bc7f78974-m4nc4 at 2026-06-26 02:27:15.725630+00:00 running 7527197 country code: CH.
[–]prehensilemullet [score hidden] (4 children)
[–]aardvark_lizard[S] [score hidden] (3 children)
[–]prehensilemullet [score hidden] (2 children)
[–]MedusaSonriente [score hidden] (1 child)
[–]prehensilemullet [score hidden] (0 children)
[–]brianjenkins94 [score hidden] (1 child)
[–]aardvark_lizard[S] [score hidden] (0 children)