I'm running a Java REST app with Apache JavaSpark in this container, but I noticed that each request is adding the memory usage and not decreasing after the request is done. My first guess was that I had forgotten to close some stream/buffer (this app deal with a lot of file manipulation), but I reviewed all the code and looks like everything is being closed.
Here is my Dockerfile:
FROM maven:3.5-jdk-8-alpine
WORKDIR /code
ADD pom.xml /code/pom.xml
RUN ["mvn", "dependency:resolve"]
ADD src /code/src
RUN ["mvn", "package"]
EXPOSE 1337
CMD exec java -jar "target/app.jar"
Here is the docker stats:
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
2db8b2f5fd72 0.16% 66.36 MiB / 1.952 GiB 3.32% 12.9 kB / 106 kB 0 B / 0 B 23