我正在使用top来监控我的服务器.交换行读取
交换:1044220k总计,0k使用,1044220k免费,148544k缓存
我点击O p按交换排序.
PID USER PR NI VIRT RES SHR S %cpu %MEM TIME+ SWAP COMMAND 703 MysqL 20 0 930m 43m 7092 S 0 8.9 0:00.66 886m MysqLd 1555 www-data 20 0 346m 9792 3208 S 0 2.0 0:00.00 337m apache2 1559 www-data 20 0 347m 10m 3712 S 0 2.2 0:00.01 336m apache2 1567 www-data 20 0 345m 9448 2552 S 0 1.9 0:00.01 336m apache2 1557 www-data 20 0 345m 9452 2556 S 0 1.9 0:00.01 336m apache2 1562 www-data 20 0 345m 9508 2344 S 0 1.9 0:00.01 336m apache2 1566 www-data 20 0 345m 9684 2684 S 0 1.9 0:00.02 335m apache2
我想知道我应该怎么读这个.这是可用于这些流程的交换吗?
今天早上顶部显示MysqLd使用了1.1 GB的交换,30%的交换用完了.在机器上投掷更多ram后,MysqLd降至886m,top表示交换使用率为0(数学似乎有意义).所以我只是想知道什么是交换列显示?为什么交换概述不反映交换列的总和?
谢谢.
解决方法
它是通过从虚拟内存中减去物理内存来计算的:
SWAP = VIRT - RES
man top更多详情:
o: VIRT -- Virtual Image (kb) The total amount of virtual memory used by the task. It includes all code,data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used. p: SWAP -- Swapped size (kb) Memory that is not resident but is present in a task. This is memory that has been swapped out but could include additional non-resident memory. This column is calculated by subtracting physical mem‐ ory from virtual memory. q: RES -- Resident size (kb) The non-swapped physical memory a task has used.