分类: LINUX
2013-01-24 11:36:25
这两天在测试mongodb的性能 top命令看看mongodb吃内存的情况 说来很惭愧 之前没有详细地看top命令的输出结果 只是大致地看一下 然后就闪过 man了top 看了一下输出结果中的三个字段代表的意思 使用了top -p mongodb_pid 只查看mongodb的状态
VIRT Virtual Image (kb)
进程所使用的虚拟内存的总和,包括了代码段,数据段,共享库和被换出(swapped out)的内存大小
RES Resident size (kb)
目前驻存在内存中实际占用量
SHR Shared Mem size (kb)
共享内存 这个是指可以和其它进程共享的内存大小
知识补充:
Cached is the size of the Linux page cache, minus the memory in the swap cache, which is represented by SwapCached (thus the total page cache size is Cached + SwapCached). Linux performs all file I/O through the page cache. Writes are implemented as simply marking as dirty the corresponding pages in the page cache; the flusher threads then periodically write back to disk any dirty pages. Reads are implemented by returning the data from the page cache; if the data is not yet in the cache, it is first populated. On a modern Linux system, Cached can easily be several gigabytes. It will shrink only in response to memory pressure. The system will purge the page cache along with swapping data out to disk to make available more memory as needed.