Live data from Hacker News

Piscina – The Node.js Worker Pool

github.com

41–50 of 51 posts

Re: Piscina – The Node.js Worker Pool

#41
post #37

Earlier quoted context omitted.

JavaScript is single threaded, Node is most certainly not.

Yes it surely is

It's not exactly. Certain operations like I/O are threaded in Node. libuv has it's own threadpool that it uses for a lot of these types of tasks.

Re: Piscina – The Node.js Worker Pool

#44
post #14

What would be nice is a way of preventing the same job running multiple times concurrently. Like if I start a job and a job with the same parameters was already started milliseconds ago then it automatically awaits the already running job rather than starting another.

Add unique job id?

Re: Piscina – The Node.js Worker Pool

#45

Neat! I’m friends with the creator of this and teased him a bit about the name (so many of these projects have weird names now a day) The reason is: don’t wanna be boring from what I could glean.

"piscina" in Italian means "pool". A library for worker pools simply named "pool" in Italian doesn't seem that strange :)

Re: Piscina – The Node.js Worker Pool

#46

Neat! I’m friends with the creator of this and teased him a bit about the name (so many of these projects have weird names now a day) The reason is: don’t wanna be boring from what I could glean.

"piscina" in Italian means "pool". A library for worker pools simply named "pool" in Italian doesn't seem that strange :)

Piscine Molitor Patel in the Life of Pi was named after the pool in Paris !

Re: Piscina – The Node.js Worker Pool

#47
Here's my issue with this kind of "magic" API design:

It's not clear when or how serialization happens.

Supposedly at some point the message I am sending to the worker is serialized, but this is not made clear to the user and it's not made clear when this happens.

A well-designed library would synchronously serialize the given object the moment it is passed in or let the user explicitly handle serialization. But I don't think that's what is happening here.

It appears messages are serialized only eventually and when they are finally sent off to a worker.

If you accidentally pass mutable state in here, you're in for a really confusing and fun debugging session. Likely it'll be a production-only bug too, because during development and testing you're unlikely to have the kind of message volume required to run into some modified-before-sent condition.

CTRL-F "mutable" and CTRL-F "serialize" gives no results, so I don't think the designers thought of this or thought to warn users.

Re: Piscina – The Node.js Worker Pool

#48
Interesting that it's written in typescript and the readme doesn't mention using it with typescript. I ran into annoyances with this recently trying out nodes worker threads in a typescript project. I was running with ts-node, but the worker thread didn't know how to load a typescript file. There are some workarounds but they're not elegant.

Re: Piscina – The Node.js Worker Pool

#49

Is it just me, or do I see a trend in naming projects using romance language words (Italian/Spanish/France)? Does it sound more exotic? Are these words less crowded?

Could you please stop creating accounts for every few comments you post? We ban accounts that do that. This is in the site guidelines: https://news.ycombinator.com/newsguidelines.html.

You needn't use your real name, of course, but for HN to be a community, users need some identity for other users to relate to. Otherwise we may as well have no usernames and no community, and that would be a different kind of forum. https://hn.algolia.com/?query=community%20identity%20by:dang...

Re: Piscina – The Node.js Worker Pool

#50
post #3
post #2

Does anybody use this or anything similar? If so, what problems are you solving?

I’m guessing the fact that node is single threaded

Node uses a thread pool for tasks like reading files async and crypto operations etc, you can read about it here https://nodejs.org/en/docs/guides/dont-block-the-event-loop/
Post reply on HN