如何理解Mesos中的CPU分配? [英] How to understand CPU allocation in Mesos?

查看:168
本文介绍了如何理解Mesos中的CPU分配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读在Mesos上构建应用程序,并遇到以下语句:

I am reading Building Applications on Mesos, and come across the following statements:

cpus
此资源表示有多少个CPU内核可用.任务可能会使用CPU的小数部分,这是可能的,因为Mesos从站使用CPU共享, 而不是保留特定的CPU.这意味着,如果您有1.5 cpus 保留,则您的进程每秒将被允许总共使用1.5秒的CPU时间.这可能意味着,在一个执行程序中,两个进程每个都每秒获得750毫秒的CPU时间,或者一个进程获得1秒的时间. CPU时间和另一个时间在给定的秒数内分别获得500毫秒的CPU时间. 使用CPU共享的好处是,如果某个任务将能够利用其共享以外的资源,而其他任何任务都不会使用原本处于空闲状态的CPU,则第一个任务可能会使用其共享之外的资源.结果,保留的cpus保证了任务可使用的CPU时间最短-如果有额外的容量可用,它将被允许使用更多的时间.

cpus
This resource expresses how many CPU cores are available. Tasks may use fractional parts of a CPU—this is possible because Mesos slaves use CPU shares, rather than reserving specific CPUs. This means that, if you have 1.5 cpus reserved, your processes will be allowed to use a total of 1.5 seconds of CPU time each second. That could mean that, within a single executor, two processes each get 750 milliseconds of CPU time per second, or one process gets 1 second of CPU time and another gets 500 milliseconds of CPU time each in a given second. The benefit of using CPU shares is that if some task would be able to utilize more than its share, and no other task would use an otherwise idle CPU, the first task can potentially use more than its share. As a result, the cpus reserved provides a guaranteed minimum of CPU time available to the task—if additional capacity is available, it will be allowed to use more.

我听不懂"if you have 1.5 cpus reserved, your processes will be allowed to use a total of 1.5 seconds of CPU time each second.".每秒如何使用CPU秒的1.5秒?

I can't understand "if you have 1.5 cpus reserved, your processes will be allowed to use a total of 1.5 seconds of CPU time each second.". How can it use 1.5 seconds of CPU time each second?

推荐答案

通过使用多个cpu/core :-).

By utilizing more than one cpu/core :-).

请注意,这些限制的实际行为/执行将在很大程度上取决于所使用的实际容器/隔离器. 不幸的是,我找不到任何好的/最新的文档(但我知道有人正在努力改善此问题:-)),但是您可以看一下此博客文章: 有关CPU资源的博客文章

Note that the actual behavior/enforcement of these limits will highly depend on the actual containerizer/isolator used. Unfortunately I could not find any good/recent documentation (but I know that there are people working on improving this :-) ), but you could have a look at this blog post: Blog Post about CPU resources

更新 CPU利用率也有一个硬性上限:请参阅 --[no]-cgroups_enable_cfs 配置参数吉拉.

Update There is als hard cap on the CPU utilization: See the --[no]-cgroups_enable_cfs configuration parameter or this Jira.

这篇关于如何理解Mesos中的CPU分配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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