如何计算Docker限制 [英] How to calculate the docker limits

查看:98
本文介绍了如何计算Docker限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了我的docker(python烧瓶).

I create my docker (python flask).

如何计算对内存和CPU的限制?

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

我们是否有一些工具可以在具有不同限制的docker上运行性能测试,然后建议最好的限制数字是什么?

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?

推荐答案

有了已经在容器中运行的应用程序,您可以使用docker stats查看CPU和内存的当前利用率.虽然将CPU限制设置得太低没有什么害处(这只会降低应用程序的运行速度,但仍会运行),但请注意将内存限制保持在最坏的情况下.当应用尝试超过其内存限制时,它们将被杀死,并且通常会通过重启策略/编排工具来重启.如果该限制设置得太低,您可能会在重新启动循环中找到您的应用.

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.

这篇关于如何计算Docker限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆