Is there a way to have a Java process either fork or launch another Java process and use shared memory in order to minimize the RAM usage?
There will be many processes in order to allow one to be safely killed without affecting the others. Also this will allow simple detection of what threads are using more memory or CPU if they are in separate processes. This should allow any process to have a crash or OutOfMemoryError without affecting the other processes.
It would be nice if we could have 100-300 java processes running at the same time,, each with its own purpose. I realize we may have to limit that number and require processes to take on multiple roles if we are to keep from robbing too much memory from the database and filesystem.
Edit:
I think I hit an incorrect meaning when I said shared memory. What I mean is just memory that can be used among multiple processes like the Java classes (not the variables). All the java packages and libraries can be reused if possible.
@George Baily – Just caught your comment above.
Yes, newer JVMs do share class text, but as I understand it only in client (non-server) JVMs. The benefit of this was reduced IO and startup time but has the added benefit in helping with a smaller footprint.
You can read more here:
http://download.oracle.com/javase/1.5.0/docs/guide/vm/class-data-sharing.html
You may also want to get aggressive on the heap resizing parameters as to allow for a smaller footprint. Though semi-commercial, I maintain a small software package that manages workloads for multiple (hundreds) JVMs and dynamically manages OS-level IO and process priority to meet workload goals. A poor-man’s WLM for JVMs. I’ve been unsuccessful thusfar in being able to manage the JVM ergonomics in runtime, but the WLM approach works surprisingly well. Let me know if you want more info.