Lxc
LXC 來賓平均負載是否與主機的平均負載相同?
如果我在客戶機上執行,負載平均值似乎與在主機上
top
執行完全相同。top
Docker (LXC) 來賓的平均負載是否與主機的平均負載相同?
查看程式碼
/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