linux performance monitoring

来源:互联网 发布:如何数据分析 编辑:程序博客网 时间:2024/05/19 22:03

Linux Performance Monitoring
CPU:

You should understand the four critical performance metrics for CPU — context switch, run queue, cpu utilization, and load average.


Context Switch

    • When CPU switches from one process (or thread) to another, it is called as context switch.
    • When a process switch happens, kernel stores the current state of the CPU (of a process or thread) in the memory.
    • Kernel also retrieves the previously stored state (of a process or thread) from the memory and puts it in the CPU.
    • Context switching is very essential for multitasking of the CPU.
    • However, a higher level of context switching can cause performance issues.


Run Queue:

    • Run queue indicates the total number of active processes in the current queue for CPU.
    • When CPU is ready to execute a process, it picks it up from the run queue based on the priority of the process.
    • Please note that processes that are in sleep state, or i/o wait state are not in the run queue.
    • So, a higher number of processes in the run queue can cause performance issues.


Cpu Utilization

    • This indicates how much of the CPU is currently getting used.
    • This is fairly straight forward, and you can view the CPU utilization from the top command.
    • 100% CPU utilization means the system is fully loaded.
    • So, a higher %age of CPU utilization will cause performance issues.


Load Average

    • This indicates the average CPU load over a specific time period.
    • On Linux, load average is displayed for the last 1 minute, 5 minutes, and 15 minutes. This is helpful to see whether the overall load on the system is going up or down.
    • Please note that this load average is calculated by combining both the total number of process in the queue, and the total number of processes in the uninterruptable task status.

Network:
  • For network interfaces, you should monitor total number of packets (and bytes) received/sent through the interface, number of packets dropped, etc.,

I/O
  • I/O wait is the amount of time CPU is waiting for I/O. If you see consistent high i/o wait on you system, it indicates a problem in the disk subsystem.
  • reads/second, and writes/second are measured in blocks. i.e number of blocks read/write per second. These are also referred as bi and bo (block in and block out).
  • tps indicates total transactions per seconds, which is sum of rtps (read transactions per second) and wtps (write transactions per seconds).

Memory
  • Virtual memory = Swap space available on the disk + Physical memory. The virtual memory contains both user space and kernel space.
  • The unused RAM will be used as file system cache by the kernel.
  • The Linux system will swap when it needs more memory. When it swaps, it writes the least used memory pages from the physical memory to the swap space on the disk.
  • Lot of swapping can cause performance issues, as the disk is much slower than the physical memory, and it takes time to swap the memory pages from RAM to disk.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


0 0
原创粉丝点击