-
Notifications
You must be signed in to change notification settings - Fork 58
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
[PROPOSAL - IN PROC Support] Run a process within the same JVM #688
Comments
+1 on using ProcessBuilder. Can you further investigate what happens to the streams? You may need to do something to send them to logs, or send them to the originating process (OpenSearch?) to handle the output. |
One other concern is how the separate processes will share/manage system resources. |
This is how I have read from the stream for ProcessBuilder:
|
This is a bigger question which I think will be answered once we start looking into the in proc support for extensions. |
That works for this trivial example. But there are some design questions we should ask (and as this is a proposal I'm asking them!)
Note that when a process terminates, some Operating Systems (Windows in particular, also Solaris) don't close the streams on process termination, which can result in resource leakage if they aren't explicitly closed. I had to work around this here. I used |
Another thing to consider is how the processes will share/coordinate resources (CPU/threads, memory, etc.). If we were to launch an Extension as a Thread, we could pass it a However, launching as a separate process loses that coordination ability. Since the processes are sharing the same JVM they're competing for the same heap space. Who wins the fight? How do we restrict the extension process(es) from exhausting resources? Are their easy ways to run extensions at a lower priority (like |
So this just calls into a |
I'm thinking there are workarounds for that using different classloaders. |
What/Why
What are you proposing?
NOTE: This proposal is not related to extension framework but talks about if a process can be run within the same JVM.
With the current extension framework, extensions are running out of process or remote node from OpenSearch cluster. This proposal talks about the multiple approaches a process can be run within the same JVM. This approaches can help us in the future for the in process support.
What problems are you trying to solve?
Results:
Using the command Java Virtual Process Status(jps) the results were found that only a single JVM is spun up for the
Main
method of the Java File and all the 3 approaches mentioned above doesn't create a new JVM to run rather runs in the same process as the JVM ofMain
method ofProcessBuilderExtensions.java
.When a simple java file is running which prints Hello World!:
When the any of the above 3 approach is running a new process within the same JVM:
The above result clearly shows that only a single JVM process is running with the above 3 approaches mentioned.
Any remaining open questions?
The question remains can we utilize the above approaches and run extension withing the same JVM of OpenSearch cluster.
The text was updated successfully, but these errors were encountered: