Recent Changes - Search:




Linux Server Performance Monitoring check and Determine when do i need a memory upgrade.

Performance Optimization is 15% brains, 85% black magic. ~ Linux Torvalds.

1. Check out when upgrades are needed, for memory, more disk space and additional servers.

Server Monitoring.

  • Tools used for monitoring:
				ps, top, uptime, free, iostat, netstat, and vmstat.

If these commands are used after the problem with the server then it is difficult to analyse what has caused the problem.

    ps auxfw|sort -nr |grep -v 0.0
  • shibu@shibu-laptop:~$ vmstat -n 2
     procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
     0  0    176   3896  21144  67548    0    0   396    87  433   737 18  4 63 14
     0  0    176   4096  19940  67708    0    0    94   362  375  1067 42  2 48  8
     0  0    176   4160  19940  67724    0    0     0     0  399  1059 16  3 82  0
     0  0    176   4148  19948  67748    0    0     0    50  623   986 15  4 81  0
  • (si)swap in and (so)swap out determines if a memory upgrade is needed.
  • Swapping should only happen under unusual circumstances. If the system is swapping routinely

then an upgrade is needed for the memory.

  • The (si) and (so) column should be 0 during normal operation.
  • If swapping is there then the process needs more time to complete the operation.
       r: The number of processes waiting for run time.
       b: The number of processes in uninterruptible sleep.

       swpd: the amount of virtual memory used.
       free: the amount of idle memory.
       buff: the amount of memory used as buffers.
       cache: the amount of memory used as cache.
       inact: the amount of inactive memory. (-a option)
       active: the amount of active memory. (-a option)

       si: Amount of memory swapped in from disk (/s).
       so: Amount of memory swapped to disk (/s).

       bi: Blocks received from a block device (blocks/s).
       bo: Blocks sent to a block device (blocks/s).

       in: The number of interrupts per second, including the clock.
       cs: The number of context switches per second.

       These are percentages of total CPU time.
       us: Time spent running non-kernel code. (user time, including nice time)
       sy: Time spent running kernel code. (system time)
       id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
       wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero.

Why do i need Swap Space ?

  • Linux uses swap space somewhat aggressively, so that as much physical memory as possible can be kept free. Linux will swap out memory pages that have not been used, even if the memory is not yet needed for anything. This avoids waiting for swapping when it is needed: the swapping can be done earlier, when the disk is otherwise idle.

When most of the system's real memory is in use, and there is a need for more, some data will be moved into swap to free real RAM memory for use by applications or for kernel use, such as for driver buffers, files, or network packets. This is called swapping out. When the data that is in swap space needs to be used it is swapped back in from swap space. The rate at which data is swapped to and from one or more swap spaces can be monitored with the 'vmstat' command's swap-in (si) and swap-out (so) columns.

Monitoring Tools





Edit - History - Print - Recent Changes - Search
Page last modified on March 08, 2007, at 04:00 AM