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

Support marshalling closures for distributed computing #2938

Closed
dodtsair opened this issue Sep 17, 2015 · 2 comments
Closed

Support marshalling closures for distributed computing #2938

dodtsair opened this issue Sep 17, 2015 · 2 comments
Labels
question Issues that look for answers.

Comments

@dodtsair
Copy link

nodejs should support marshalling closures between two different node instances. You can imagine this being used by a jobs library.

var from = "user@nodejs.org";
var to = "featurerequest@nodejs.org"
...
job.post(function() {
    emailService.send(from, to, {subject: "Feature request - marshal closures", body: "Nodejs should support marshalling closures for distributed computing"});
});

In this example to and from should be marshalled with the closure. The result could be read into another nodejs instance and executed to send an email. This technique is used extensively with jenkins to send work from the master instance to the slave instance.

As demonstrated by the sample code there is a technical question. How would you handle emailService? Does it get marshalled? How do you refer to a component that is on the target and not on the source? Would there be a need to mark things so that they are not marshalled?

For example the code could be changed to:

var from = "user@nodejs.org";
var to = "featurerequest@nodejs.org"
...
job.post(function() {
    require(emailService).send(from, to, {subject: "Feature request - marshal closures", body: "Nodejs should support marshalling closures for distributed computing"});
});

Would the require function not get marshalled, would the result of the require call return the target's email service?

@brendanashworth brendanashworth added the question Issues that look for answers. label Sep 17, 2015
@vkurchatkin
Copy link
Contributor

What you propose seems very hard to implement (if not impossible) and not worth it. You can achieve the same result by having a global registry of jobs and passing parameters as json.

@bnoordhuis
Copy link
Member

This would have to be implemented in V8 first and they're unlikely to entertain such feature requests. Closing, not actionable.

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

No branches or pull requests

4 participants