3.2.3. Example Usage


Example 3.2. Limiting CPU access

The following examples assume you have an existing hierarchy of cgroups configured and the cpu subsystem mounted on your system:
  • To allow one cgroup to use 25% of a single CPU and a different cgroup to use 75% of that same CPU, use the following commands:
    ~]# echo 250 > /cgroup/cpu/blue/cpu.shares
    ~]# echo 750 > /cgroup/cpu/red/cpu.shares
  • To limit a cgroup to fully utilize a single CPU, use the following commands:
    ~]# echo 10000 > /cgroup/cpu/red/cpu.cfs_quota_us
    ~]# echo 10000 > /cgroup/cpu/red/cpu.cfs_period_us
  • To limit a cgroup to utilize 10% of a single CPU, use the following commands:
    ~]# echo 10000 > /cgroup/cpu/red/cpu.cfs_quota_us
    ~]# echo 100000 > /cgroup/cpu/red/cpu.cfs_period_us
  • On a multi-core system, to allow a cgroup to fully utilize two CPU cores, use the following commands:
    ~]# echo 200000 > /cgroup/cpu/red/cpu.cfs_quota_us
    ~]# echo 100000 > /cgroup/cpu/red/cpu.cfs_period_us
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.