Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outside of event-loop #240

Open
janat08 opened this issue Jun 8, 2017 · 2 comments
Open

Outside of event-loop #240

janat08 opened this issue Jun 8, 2017 · 2 comments
Labels

Comments

@janat08
Copy link

janat08 commented Jun 8, 2017

So if I were to run very expensive computation, what would happen is that it would suspend as soon as something should be done in event-loop?

@vsivsi vsivsi added the question label Jun 8, 2017
@vsivsi
Copy link
Owner

vsivsi commented Jun 8, 2017

Is this is a general node.js question? Not specific to job-collection?

In general, because node.js is single threaded, expensive calculations should be avoided specifically because the block the event-loop. There is no automatic "suspending" of computation in node.js.

Where job-collection can help is by helping to move expensive computations out of your server's event loop and onto separate vanilla node.js worker processes (either on the same physical server, or on other machines reachable from it). This is the point of the meteor-job npm package. You must manage these worker processes yourself, and must establish and maintain their DDP connections to the server(s) hosting the job-collection. But after that, job-collection will distribute the work, and collect progress, status, results, etc.

Hope that helps.

@janat08
Copy link
Author

janat08 commented Jun 8, 2017

fine. I think ill just try scaling horizontally first and try and break up this computation. I'm hoping that there's a way to look at server load before accepting work? Mongo server uses significant amount of ram for each connected meteor.js (DDP, I suppose), looking to double hosting servers as workers is a valid form of laziness.

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

No branches or pull requests

2 participants