Java memory usage
-
Hello,
I wanted to use script to increase memory space for Java to use.I've copied "memory-small.sh" script from "ext-available" to "ext-enabled" folder. And unfortunally nothing happens. In internal metrics there's still "JVM maximum available memory (MB) - 622Mb" and nothing changes.
Mango version is licensed 2.8.8.
Greetings
-
Hi C00L3R,
Might it be possible you are restarting the instance from within Mango? That script only modifies the JAVA_OPTS in the "init" portion of the script lifecycle, such that it doesn't repeatedly modify them at restart. So, you would need to stop Mango completely, then start it again to pick up things in "init" blocks in the ext scripts.
You should be able to see that the modified JAVA_OPTS have taken effect by doing a
ps $(pidof java)
at the command line once its running, which will show the memory settings in the description of the process / arguments.Alternatively, might you be on Windows and need to use the .bat file?
-
Yes, Mango is running od Windows system.
So I tried with putting a .bat file in "ext-enabled" folder.memory-small.bat
if "%1" == "init" ( rem Startup with Java Memory setup for small installation set JAVAOPTS=%JAVAOPTS% -Xms2500m -Xmx3200m )
It still doesn't work. But when I tried .bat file on my test Mango installation with core 3.2.1 it worked perfectly.
//Edit
Hm, in Mango 3,2,1 on Windows max memory space limit comes from .sh file. I tried deleting .bat file and nothing changes. When I changed limits in .sh file to 1600M, I see in task manager the Java is taking that 1600M.
-
The scripts in Mango/bin haven't changed in the 3.3 series (and the changes since 3.2.1 haven't had anything to do with extension scripts), and minimal changes for quite some time prior. My test is once with both a .bat and a .sh memory file in ext-enabled, with the bat setting memory to 1600 and the sh setting it to 1500, then again with only the sh file in ext-enabled.
With both,
With only sh
So I believe you are mistaken. You need to completely stop Mango, then start it again, to have the ext scripts called with the 'init' first argument.
-
Yes I tried to stop and start Mango again but it didn't help at all.
Finally I resolved it by editing script in ma-start.bat -
"%EXECJAVA%" %JPDA% %JAVAOPTS% -server -Xmx2500m -Xms1000m -Dma.home="%MA_HOME%" -cp "%MA_CP%" com.serotonin.m2m2.Main
Maybe it's not elegant but now I see change in memory usage after starting Mango.
Thanks for help.
Greetings