LXC 来宾负载平均值与主机负载平均值相同吗?

LXC 来宾负载平均值与主机负载平均值相同吗?

如果我在来宾上运行,负载平均值似乎与在主机上top运行完全相同。top

Docker (LXC) 来宾的平均负载与主机的平均负载相同吗?

答案1

查看代码/proc/loadavg- 是的,是一样的。负载平均值是从全局变量中读出的。

      seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
              LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
              LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
              LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
              nr_running(), nr_threads,
              task_active_pid_ns(current)->last_pid);

http://lxr.free-electrons.com/source/fs/proc/loadavg.c#L13

void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
{
        loads[0] = (avenrun[0] + offset) << shift;
        loads[1] = (avenrun[1] + offset) << shift;
        loads[2] = (avenrun[2] + offset) << shift;
}

http://lxr.free-electrons.com/source/kernel/sched/proc.c#L79

相关内容