How to calculate the docker limits

12/27/2018

I create my docker (python flask).

How can I calculate what is the limit to put for memory and CPU?

Do we have some tools that run performance tests on docker with different limitation and then advise what is the best limitation numbers to put?

-- Shurik
devops
docker
kubernetes

2 Answers

12/27/2018

This is more about the consumption of your specific Flask application, you can probably take use the resource module in Python to calculate them.

More information here and here.

-- Rico
Source: StackOverflow

12/27/2018

With an application already running inside of a container, you can use docker stats to see the current utilization of CPU and memory. While there it little harm in setting CPU limits too low (it will just slow down the app, but it will still run), be careful to keep memory limits above the worst case scenario. When apps attempt to exceed their memory limit, they will be killed and usually restarted by a restart policy/orchestration tool. If the limit is set too low, you may find your app in a restart loop.

-- BMitch
Source: StackOverflow