[SOLVED] Reduce memory footprint through javaws.vmoptions?

The public knowledge pool and discussion forum of the OWS community. Do not post confidential information here!
steffenrh
Posts: 16
Joined: 06 May 2020, 13:24

[SOLVED] Reduce memory footprint through javaws.vmoptions?

Post by steffenrh »

Hello,

I'm trying to reduce the memory footprint of OpenWebStart by tweaking the VM parameters. For example, when starting with no custom parameters, the javaws.exe consumes ~500-600MB of memory on a 16GB System. On a Windows terminalserver with 80GB of RAM and 64GB pagefile we can even see ~ 1.4GB memory allocation by javaws.exe. :(

For testing purpose I've added the following options to C:\Program Files\OpenWebStart\javaws.vmoptions :

-Xms64m
-XX:+UseG1GC
-XX:MaxHeapFreeRatio=40

With the next start of a web start application, I can see that the Private Bytes footprint (Sysinternals Process Explorer 64) of javaws.exe has dropped down to ~ 120 MB, after a while stabilizing at ~ 180MB. VisualVM shows me, that 64MB heap size are more than enough to run javaws.exe. On the 80GB terminal server it stabilizes at ~ 250MB, which is still more than 1GB less RAM wasted.

We also edited our application's JNLP files to contain java-vm-args="-Xms128m -XX:+UseG1GC -XX:MaxHeapFreeRatio=40", among other options given in this attribute. This reduced the memory footprint of the started application by around 75%. We don't see any negative impact until now. Also here VisualVM shows sufficient free heap space available, and if necessary, the application may allocate more.

I think the problem is, that the Java VM sets the initial heap size depending on the RAM it sees on the system at init phase. Much RAM = big initial heap size, no matter how much really is required. Maybe that's acceptable on a single user system, but on a Windows terminal server this is a No Go. Therefore we try to minimize the initial memory footprints, fully aware that in rare cases, where the application really needs more memory, we'll lose some millisecs for the memory allocation.

Question: Does anyone have similar results with minimizing the memory footprint? Do you think there are risks when configuring like shown above?

cu, Steffen

Janak Mulani
Posts: 246
Joined: 24 Mar 2020, 13:37

Re: Reduce memory footprint through javaws.vmoptions?

Post by Janak Mulani »

Hello Steffen,

For running OWS using the bundled jre with a smaller memory footprint what you are doing is correct, i.e. specifying jvm args in javaws.vmoptions.

For running the application using the preferred JVM with smaller memory footprint it is correct to specify appropriate jvm args in the jnlp file. OWS will apply these args to the JVM that starts the application specified in the jnlp file.

We will experiment with this further and investigate if we can specify built in JVM args to start javaws with the bundled jre with minimum possible initial memory footprint.

Thanks for reporting this issue.

Janak

Janak Mulani
Posts: 246
Joined: 24 Mar 2020, 13:37

Re: Reduce memory footprint through javaws.vmoptions?

Post by Janak Mulani »

Hello Steffen,

This will be fixed in v 1.3.0 to be released in November. The bundled JVM will be started with arg -Xms64m.

Thanks for reporting this issue.

- Janak

Post Reply