rmss 命令的 -c、-p 和 -r 标志

使用 rmss 命令的 -c-p-r 标志的优点是它们允许您试验无法表示为单个可执行程序或 shell 脚本文件的复杂应用程序。 另一方面,使用 -c-p-r 选项的缺点是它们强迫您自己进行性能评估。 幸运的是,可以用 vmstat -s 命令来评估应用程序运行时的调页空间的活动。

通过运行 vmstat -s 命令,运行您的应用程序,再次运行 vmstat -s 命令,然后将调页空间页面调进后的数量减去调页空间页面调进前的数量,您就可以确定程序运行时发生的调页空间页面调进的数量。 而且,通过对您程序计时,并将调页空间插入页的数量除以程序消耗的时间,可以得到调页空间页面调进的平均速率。

在每个内存容量下多次运行应用程序也是相当重要,因为两个原因:

  • 更改内存大小时,rmss 命令经常清理出大量内存。 因此,第一次内存大小变换后运行应用程序,有可能有一部分实质运行的时间是应用程序将文件读入实内存。 但是,因为应用程序结束后这些文件仍驻留在内存中,后来该应用程序的执行会因此而消耗较短的时间。
  • 为了获取一个内存大小下应用程序的平均性能, 不太可能每次应用程序运行时复制系统状态。 因此一遍又一遍地运行会使得该应用程序的性能变化相当大。
概括的说,考虑以下一系列的步骤作为调用 rmss 命令的方法:
while there are interesting memory sizes to investigate:
  {
  change to an interesting memory size using rmss -c;
  run the application once as a warm-up;
  for a couple of iterations:
    {
    use vmstat -s to get the "before" value of paging-space page ins;
    run the application, while timing it;
    use vmstat -s to get the "after" value of paging-space page ins;
    subtract the "before" value from the "after" value to get the
       number of page ins that occurred while the application ran;
    divide the number of paging-space page ins by the response time
       to get the paging-space page-in rate;
    }
  }
run rmss -r to restore the system to normal memory size (or reboot)

可以使用 磁盘或与内存相关的问题中描述的 vmstatit 脚本来自动计算 (之前的) 页面调度 I/O 号。