我有一个非常繁忙的GNU / Linux服务器,我认为需要更多的RAM。 我知道free命令没有显示使用的RAM数量。
所以我在/proc/meminfo 。 它目前显示57972 kB这是不多的。 这是进程使用“现在”的RAM的数量,或者这是一个额外的RAM多less估计,永远不会用这个负载的内存不足?
是的,Committed_AS是寻找的领域。 Robert说,99.99%的保证,如果所有的内存请求在该特定的时刻被内核授予和分配,系统将不会OOM。
从内核源码。
Committed_AS: The amount of memory presently allocated on the system.
714 The committed memory is a sum of all of the memory which
715 has been allocated by processes, even if it has not been
716 "used" by them as of yet. A process which malloc()'s 1G
717 of memory, but only touches 300M of it will only show up
718 as using 300M of memory even if it has the address space
719 allocated for the entire 1G. This 1G is memory which has
720 been "committed" to by the VM and can be used at any time
721 by the allocating application. With strict overcommit
722 enabled on the system (mode 2 in 'vm.overcommit_memory'),
723 allocations which would exceed the CommitLimit (detailed
724 above) will not be permitted. This is useful if one needs
725 to guarantee that processes will not fail due to lack of
726 memory once that memory has been successfully allocated.
它在源代码中声明为结构,并在_vm_enough_memory()函数中用于查看进程是否可以在内存中增长。
为了简化,这是一个非常好的参数来监视内存问题。
Committed_As是估计需要多less内存才能使99.99%保证永远不会有OOM。
这就是说我不确定这是多么准确,或者如果我打赌农场。 在我目前的服务器上,它几乎是我的活动+不活动的内存使用情况的两倍,而在另一台服务器上,它显示了61MB,而服务器在活动中有一个演出。 有点提出我对这个数字的怀疑…