0

We are using docker swarm on the server. using openjdk8. If do :

docker service ls

see the result :

ID                  NAME                               MODE                REPLICAS            IMAGE                                                                PORTS
7l89205dje61        integration_api                          replicated          1/1                 docker.repo1.tomba.com/koppu/koppu-api:3.1.2.96019dc
.................        

I am trying to update jvm heap size for this service so I tried :

docker service update --env-add JAVA_OPTS="-Xms3G -Xmx3G -XX:MaxPermSize=1024m" integration_api

Saw this result:

integration_api
overall progress: 1 out of 1 tasks 
1/1: running   [==================================================>]

Now I am trying to see the heap size and not finding a way as when tried to get inside the container taking the id above as :

docker exec -it 7l89205dje61 bash

getting error :

this container does not exit.

Any suggestion?

trincot
  • 317,000
  • 35
  • 244
  • 286
VictorGram
  • 2,521
  • 7
  • 48
  • 82

2 Answers2

1

Perhaps you can exec into the running container and display the current heap size with something like this?

# get the name of a container within your service with
docker exec -it <CONTAINER-ID> bash

# after execing into the container,
java -XX:+PrintFlagsFinal -version | grep HeapSize

Use this Stack Orerflow post to figure out how to exec into a service

Got the java code to print heap settings from this Stack Overflow post

ranvit
  • 99
  • 6
0

Note these ideas don't have a good example out there as yet to my knowledge. However, one good way of doing it is to implement a "healthcheck" process that would query the JVM statistics like heap and other things and report it to another system.

Another way is exposing the Spring Boot Actuator API so that Prometheus can read and track it over time.

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265