I am running a docker container which has bundled the java application (Java 1.8).
My problem is my IOT device has limited memory (RAM 2 GB and need to share by 5 application).
When I tried to run my application I have reserved 450 MB RAM and allocated 50% to JVM as bellow:
FROM openjdk:8u252-jre-slim-buster
ADD myIotApp.jar myIotApp.jar
ADD jsr47min.properties jsr47min.properties
CMD java -Djava.util.logging.config.file=jsr47min.properties -jar -XX:+UseContainerSupport -XX:MaxRAMPercentage=50.0 -XshowSettings:vm myIotApp.jar
I understand JVM needs some memory to run smoothly and there are some compatibility issue (As mentioned in the bellow thread): https://developers.redhat.com/blog/2017/03/14/java-inside-docker/
But I have taken suggestion to overcome this.
But I have observed as soon as application executes some complex operation it consumes almost 80% memory but never releases back once computation is done.
Is there any way to fix this problem?
or
Is java a good choice for such environment?