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

Restructure remote node processes and allow for multiple connections #434

Merged
merged 2 commits into from
Jul 5, 2021

Conversation

jonatanklosko
Copy link
Member

@jonatanklosko jonatanklosko commented Jul 5, 2021

Current design

So far we would start a top-level Manager process on the remote node. This process would then configure the node (register stderr, logger, compiler opts), handle evaluation requests and then clean up on termination. Given the configure-cleanup logic, we generally enforced only a single Manager process per node, and used some additional configuration to handle the Embedded runtime.

New design

Now we split the Manager into separate pieces:

  • NodeManager - similarly to the current manager, it's the primary process we start and it configures and cleans up the given node. It then spawns a number of RuntimeServer processes - each for an individual runtime connection. When all RuntimeServers terminate, the manager itself also terminates and does the necessary cleanup.

  • RuntimeServer - a remote process behind each %Runtime{}. It's simply responsible for orchestrating evaluation/completion - in short it builds on top of Evaluators to satisfy the requirements of the Runtime protocol.

To initialize a remote node we start a NodeManager and then allow for arbitrarily many runtime connections, each getting it's own RuntimeServer. Once all connections are closed NodeManager automatically cleans up and unloads the dynamically loaded modules.

Implications

Separating node configuration and runtime requests logic makes for a nice refactoring. This also unifies Embedded runtime with other runtime types much more. Finally this makes it possible to connect multiple sessions to the same node using AttachedRuntime (cc @brainlid).

Copy link
Contributor

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment and ship it!

@jonatanklosko jonatanklosko merged commit 9b2f039 into main Jul 5, 2021
@jonatanklosko jonatanklosko deleted the jk-runtime-servers branch July 5, 2021 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants