-
Notifications
You must be signed in to change notification settings - Fork 11
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
Question : is it possible support multiple NodeJS main threads ? #10
Comments
Well, NodeJS/GraalJS supports the JavaScript workers API, that's how the event loop dispatch is implemented internally. So I think the answer is yes. However, I'm not actually a JS dev so there may be limitations to workers I'm not aware of. The trick is to refactor Do you think you can tackle that yourself? |
Thanks for the feedback, So with your feedback :
What do you think? |
Yes, that sounds about right. For (1) the purpose of that check is to provide expected re-entrancy semantics. If that wasn't the case then entering a NodeJS block from the NodeJS thread wouldn't work properly (I think). So it needs to be adjusted to not treat "the node thread" specially but it should still short-circuit dispatch when on the right thread already. I'm not entirely sure how Contexts map to Workers. I suspect each worker thread has its own context, so, again, that would need to be generalised. For (3) yes, same thing. Basicallly we need to split the NodeJVM object into a For bonus points you could try customising ThreadPoolExecutor so the number of threads and the underlying task queues are managed automatically. |
Actually I think that while developing NodeJVM you faced the same question, oracle/graaljs#12 :)
I am developing a proof of concept based on NodeJVM and the ability to launch a spring boot application that can delegate work to a nodeJS thread that will execute some jsdom stuff.
So far so good, NodeJVM is really impressive, thanks!
While profiling the application I realized that spring-boot+reactor could overwhelm the NodeJS main thread, and thus I was wondering if it could be possible to spawn work to more than one nodejs event loop, I am not willing to share any state between Java and JS
The text was updated successfully, but these errors were encountered: