3

While a java application server will extend a unique JVM to run several (micro)services, a dockerized java microservices architecture will run a JVM for each dockerized microservice. Considering 20+ java microservices and a limited number of host it seems that the amount of resources consumed by the JVMs on each host is huge.

Is there an efficient way to manage this problem ? Is it possible to tune each JVM to limit resources consumption ? The aim is to limit the overhead of using docker in a java microservices architecture.

1
  • 1
    You didn't ask anything. What is your problem? Commented Sep 7, 2016 at 8:14

1 Answer 1

3

Each Docker and JVM copy running uses memory. Normally having multiple JVMs on a single node would use shared memory, but this isn't an option with docker.

What you can do is reduce the maximum heap size of each JVM. However, I would allow at least 1 GB per docker image as overhead plus your heap size for each JVM. While that sounds like a lot of memory it doesn't cost so much these days.

Say you give each JVM a 2 GB heap and add 1 GB for docker+JVM, you are looking needing a 64 GB server to run 20 JVMs/dockers.

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks for the answer. Where can I find some 'casual' values for the JVM stack ? Actually, 500MB seems largely enough for my µS (even in charge). (I check it with jvisualv). So I am impressed by the values ​​that you recommend .
@DouglasAdams some of our clients have JVM with 100 TB virtual memory sizes. If you have 0.5 GB heap per JVM you will find you need quite a bit more in over head.
@DouglasAdams what do you mean by values for the JVM stack? Do you mean what are the defaults? If you have a small number of threads it shouldn't need tuning.
Our µS are generally single threaded and not very greedy (no complex calculus). In this case, do you recommend to reduce the value of the heap? Or is it better to leave the default values?
@DouglasAdams If each JVM is in it's own Docker, it will use 1/4 of the memory given to each Docker by default. The JVM is tuned assuming it's not the only application on the machine. Most likely you will want to set the maximum heap size to be all the available memory after the OS and memory needed to run the JVM.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.