AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 446081
Accepted
Alexander Gladysh
Alexander Gladysh
Asked: 2012-11-07 12:02:57 +0800 CST2012-11-07 12:02:57 +0800 CST 2012-11-07 12:02:57 +0800 CST

CPU 核心利用率不均匀

  • 772

tl;dr:第一个 CPU 内核一直处于饱和状态,所有其他内核一直处于负载不足状态。

基于 Ubuntu 的 Xen XCP 中的虚拟机:

$ uname -a
Linux MYHOST 2.6.38-15-virtual #59-Ubuntu SMP Fri Apr 27 16:40:18 UTC 2012 i686 i686 i386 GNU/Linux

$ lsb_release -a
没有可用的 LSB 模块。
经销商 ID:Ubuntu
描述:Ubuntu 11.04
发布:11.04
代号:natty

此 VM 有 8 个 CPU 内核。

该VM上运行着10个单线程工作进程,它们通过FCGI接口连接到nginx服务器(监听本地网络端口)。

在来自 AB 的合成负载下,只有八个核心中的第一个核心被加载到 100%(如从 中看到的htop)。它或多或少一直处于非常高的负载下,所有其他内核的负载从 0% 到 100%,或多或少是随机的(这些内核的 CPU 负载在跳跃)。

以下是我通常在负载下看到的内容htop:

  1 [||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||99.3%] 任务:70、35 thr;11 跑步
  2 [|||||||||||||| 15.0%] 平均负载:3.86 1.05 0.39
  3 [||||||||||||||||||||||||||||||||||||||||| 36.7%] 正常运行时间:22 天,06:31:57
  4 [||||||||||||||| 15.7%]
  5 [|||||||||||||||||||| 22.4%]
  6 [|||||||||||||||||| 19.9%]
  7 [||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||| 71.2%]
  8 [|||||||||||||||||||||||||||| 31.3%]
  内存[||||||||||||||||||||||||||||||||||||||||||||| ||||||||||||||||||||||||||||||||394/4028MB]
  Swp[0/5362MB]

  PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ 命令
26213 www-data 20 0 49748 26952 2448 R 29.0 0.7 10:42.61 /usr/bin/luajit2
26227 www-data 20 0 50172 27412 2452 R 27.0 0.7 10:43.53 /usr/bin/luajit2
26221 www-data 20 0 50736 27948 2452 R 27.0 0.7 10:39.02 /usr/bin/luajit2
26234 www-data 20 0 50128 27232 2452 R 27.0 0.7 10:36.36 /usr/bin/luajit2
26218 www-data 20 0 50232 27376 2452 R 26.0 0.7 10:39.32 /usr/bin/luajit2
26214 www-data 20 0 51268 28496 2452 R 26.0 0.7 10:58.15 /usr/bin/luajit2
26232 www-data 20 0 50420 27588 2452 R 25.0 0.7 10:39.21 /usr/bin/luajit2
26217 www-data 20 0 50236 27348 2452 R 25.0 0.7 10:34.44 /usr/bin/luajit2
26219 www-data 20 0 50748 27960 2448 R 23.0 0.7 10:45.30 /usr/bin/luajit2
26239 www-data 20 0 49772 27188 2452 R 22.0 0.7 10:39.39 /usr/bin/luajit2
26368 www-data 20 0 10856 3796 968 S 15.0 0.1 1:12.62 nginx: 工作进程
26369 www-data 20 0 10652 3504 968 S 2.0 0.1 1:12.75 nginx: 工作进程
26372 www-data 20 0 10520 3504 968 S 0.0 0.1 1:18.64 nginx: 工作进程
...

在负载测试期间,所有工作进程都在R,负载测试运行大约 10-15 分钟(性能约为 700-900 次点击/秒)。流量当然是从外部机器产生的。

看起来这个 CPU 核心负载不平衡是主要的性能瓶颈,如果所有核心负载均匀,性能可能会更高。

有关如何解决此问题的任何线索?

请告诉我是否可以提供更多信息。

ubuntu
  • 2 2 个回答
  • 1472 Views

2 个回答

  • Voted
  1. Best Answer
    Alexander Gladysh
    2012-11-07T22:03:43+08:002012-11-07T22:03:43+08:00

    看起来 CPU0 收到了每个 eth1 中断,而且有很多。

    $ cat /proc/中断
               CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7       
    283: 113720624 0 0 0 0 0 0 0 xen-dyn-event eth1
    284: 1 0 0 0 0 0 0 0 xen-动态事件 eth0
    285: 2254 0 0 3873799 0 0 0 0 xen-dyn-事件 blkif
    286: 23 0 0 0 0 0 0 0 xen-dyn-事件 hvc_console
    287: 492 42 0 0 0 0 0 295324 xen-dyn-事件 xenbus
    288: 0 0 0 0 0 0 0 222294 xen-percpu-ipi callfuncsingle7
    289: 0 0 0 0 0 0 0 0 xen-percpu-virq debug7
    290: 0 0 0 0 0 0 0 151302 xen-percpu-ipi callfunc7
    291: 0 0 0 0 0 0 0 3236015 xen-percpu-ipi resched7
    292:0 0 0 0 0 0 0 60064 xen-percpu-ipi 自旋锁 7
    293: 0 0 0 0 0 0 0 12355510 xen-percpu-virq 定时器 7
    294: 0 0 0 0 0 0 803174 0 xen-percpu-ipi callfuncsingle6
    295: 0 0 0 0 0 0 0 0 xen-percpu-virq debug6
    296: 0 0 0 0 0 0 60027 0 xen-percpu-ipi callfunc6
    297: 0 0 0 0 0 0 5374762 0 xen-percpu-ipi resched6
    298: 0 0 0 0 0 0 64976 0 xen-percpu-ipi 自旋锁6
    299: 0 0 0 0 0 0 15294870 0 xen-percpu-virq 定时器 6
    300: 0 0 0 0 0 264441 0 0 xen-percpu-ipi callfuncsingle5
    301: 0 0 0 0 0 0 0 0 xen-percpu-virq debug5
    302: 0 0 0 0 0 79324 0 0 xen-percpu-ipi callfunc5
    303: 0 0 0 0 0 3468144 0 0 xen-percpu-ipi resched5
    304: 0 0 0 0 0 66269 0 0 xen-percpu-ipi 自旋锁5
    305: 0 0 0 0 0 12778464 0 0 xen-percpu-virq 定时器 5
    306: 0 0 0 0 844591 0 0 0 xen-percpu-ipi callfuncsingle4
    307: 0 0 0 0 0 0 0 0 xen-percpu-virq debug4
    308: 0 0 0 0 75293 0 0 0 xen-percpu-ipi callfunc4
    309: 0 0 0 0 3482146 0 0 0 xen-percpu-ipi resched4
    310: 0 0 0 0 79312 0 0 0 xen-percpu-ipi 自旋锁 4
    311: 0 0 0 0 21642424 0 0 0 xen-percpu-virq 定时器 4
    312: 0 0 0 449141 0 0 0 0 xen-percpu-ipi callfuncsingle3
    313: 0 0 0 0 0 0 0 0 xen-percpu-virq debug3
    314: 0 0 0 95405 0 0 0 0 xen-percpu-ipi callfunc3
    315: 0 0 0 3802992 0 0 0 0 xen-percpu-ipi resched3
    316: 0 0 0 76607 0 0 0 0 xen-percpu-ipi 自旋锁3
    317: 0 0 0 16439729 0 0 0 0 xen-percpu-virq 定时器 3
    318: 0 0 876383 0 0 0 0 0 xen-percpu-ipi callfuncsingle2
    319: 0 0 0 0 0 0 0 0 xen-percpu-virq debug2
    320: 0 0 76416 0 0 0 0 0 xen-percpu-ipi callfunc2
    321: 0 0 3422476 0 0 0 0 0 xen-percpu-ipi resched2
    322: 0 0 69217 0 0 0 0 0 xen-percpu-ipi 自旋锁2
    323: 0 0 10247182 0 0 0 0 0 xen-percpu-virq 定时器 2
    324: 0 393514 0 0 0 0 0 0 xen-percpu-ipi callfuncsingle1
    325: 0 0 0 0 0 0 0 0 xen-percpu-virq debug1
    326: 0 95773 0 0 0 0 0 0 xen-percpu-ipi callfunc1
    327: 0 3551629 0 0 0 0 0 0 xen-percpu-ipi resched1
    328:0 77823 0 0 0 0 0 0 xen-percpu-ipi 自旋锁 1
    329: 0 13784021 0 0 0 0 0 0 xen-percpu-virq 定时器 1
    330: 730435 0 0 0 0 0 0 0 xen-percpu-ipi callfuncsingle0
    331: 0 0 0 0 0 0 0 0 xen-percpu-virq debug0
    332: 39649 0 0 0 0 0 0 0 xen-percpu-ipi callfunc0
    333: 3607120 0 0 0 0 0 0 0 xen-percpu-ipi resched0
    334: 348740 0 0 0 0 0 0 0 xen-percpu-ipi 自旋锁0
    335: 89912004 0 0 0 0 0 0 0 xen-percpu-virq timer0
    NMI: 0 0 0 0 0 0 0 0 不可屏蔽中断
    LOC:0 0 0 0 0 0 0 0 本地定时器中断
    SPU:0 0 0 0 0 0 0 0 虚假中断
    PMI: 0 0 0 0 0 0 0 0 性能监控中断
    IWI: 0 0 0 0 0 0 0 0 IRQ 工作中断
    RES:3607120 3551629 3422476 3802992 3482146 3468144 5374762 3236015 重新安排中断
    CAL:770084 489287 952799 544546 919884 343765 863201 373596 函数调用中断
    TLB:0 0 0 0 0 0 0 0 TLB 击落
    TRM:0 0 0 0 0 0 0 0 热事件中断
    THR:0 0 0 0 0 0 0 0 APIC 中断阈值
    MCE: 0 0 0 0 0 0 0 0 机器检查异常
    MCP:0 0 0 0 0 0 0 0 机器检查轮询
    错误:0
    管理信息系统:0
    
    • 5
  2. ArrowInTree
    2012-12-20T12:49:55+08:002012-12-20T12:49:55+08:00

    嗯,

    为什么你没有提到taskset?taskset -p pid将检索亲和力...

    将 -c 添加到 taskset 以指定一个 cpulist:在这种情况下,除了 0 以外的任何东西。

    • -3

相关问题

  • 无法通过 Ubuntu VPN 访问外部网络

  • ubuntu apt-get upgrade - 如何在 shell 中单击确定?

  • VirtualBox 上 Ubuntu 的访客优化技巧 [关闭]

  • 外部硬盘上的 virtualbox 虚拟硬盘驱动器(Vista 主机上的 ubuntu 客户机)

  • 如何在 Ubuntu 上挂载 LVM 分区?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve