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.
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
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
then an upgrade is needed for the memory.
Procs r: The number of processes waiting for run time. b: The number of processes in uninterruptible sleep. Memory 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) Swap si: Amount of memory swapped in from disk (/s). so: Amount of memory swapped to disk (/s). IO bi: Blocks received from a block device (blocks/s). bo: Blocks sent to a block device (blocks/s). System in: The number of interrupts per second, including the clock. cs: The number of context switches per second. CPU 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 ?
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.