9.3.4. 在隔离的 CPU 之间分散多个容器


要在隔离的 CPU 之间运行多个容器,您可以使用 --cpuset-cpus 选项指定每个容器应使用哪些 CPU。这会划分多个隔离的 CPU 的负载,从而提高性能并减少争用。

您可以划分在多个容器间设置的 isolcpus,以模拟以下任务:

  • 并发对延迟敏感的任务。
  • 跨分区系统进行多个负载。

9.3.4.1. 模拟并发对延迟敏感的任务

要模拟并发对延迟敏感的任务,您可以将特定的隔离 CPU 分配给每个容器。以下示例演示了如何在不同的 CPU 集间配置和运行容器。

在 CPU 0-6 上运行一个容器,在 CPU 7-28 上运行另一个容器,在 CPU 29-47 上运行第三个容器。使用以下命令:

$ podman run -it --rm --privileged --pids-limit=0 --cpuset-cpus 0-6 registry.redhat.io/rhel10/rteval \
    /bin/bash -c 'rteval --duration 2h --onlyload --loads-cpulist 0-6'
$ podman run -it --rm --privileged --pids-limit=0 --cpuset-cpus 7-28 registry.redhat.io/rhel10/rteval \
    /bin/bash -c 'rteval --duration 2h --onlyload --loads-cpulist 7-28'
$ podman run -it --rm --privileged --pids-limit=0 --cpuset-cpus 29-47 registry.redhat.io/rhel10/rteval \
    /bin/bash -c 'rteval --duration 2h --onlyload --loads-cpulist 29-47'
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部