Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Thread-based workers #110

Open
markfinger opened this issue Jun 14, 2016 · 3 comments
Open

Thread-based workers #110

markfinger opened this issue Jun 14, 2016 · 3 comments

Comments

@markfinger
Copy link
Owner

This is an interesting read on threading in Node
http://neilk.net/blog/2013/04/30/why-you-should-use-nodejs-for-CPU-bound-tasks/

In general, it seems more practical these days:

Though, there is still the usual caveat with JS workers that they only evaluate scripts, so you need to build libraries with webpack/browserify.

The big benefit of threads (vs node's cluster or fork) would be reduced memory usage. A common problem that we've hit on servers (both during CI and deployment) is that we blow out the VM's memory limit and the build process dies halfway. Threads might be a solution to this problem.

@markfinger
Copy link
Owner Author

#86

@markfinger
Copy link
Owner Author

Didn't take much poking through the issues for each of the threading libraries before issues start emerging (lack of event loop and primitives - setTimeout, etc).

That being said, I did come across one exciting little thing: nodejs/node#2133 (comment)

@markfinger markfinger changed the title Threading Thread-based workers Jun 14, 2016
@markfinger
Copy link
Owner Author

Something I've been struggling to handle cleanly is how to handle multiple phases with workers.

The use-case that's rolling around involves an initial transformation/dep-analysis phase, followed by contextual rewrites of the file (dep paths, inlining assets, etc).

Fundamentally, it looks like a question of how to handle resumable/iterative jobs across separate processes?

Probably need some notion of jobs where we can handle multiple iterations of work on assets. A key part of this would be preserving references to expensive data (ASTs, for example) and trying to minimise transport overhead. Also need to cover invalidating records.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant