Summary of essential performance analysis tools for O & M in linux

Source: Internet
Author: User
Summary: 1. vmstat: monitors and analyzes the memory information, processes, and CPUs of the operating system # vmstat23 updates and outputs every two seconds, stop after three counts. [Root @ MYDB1 ~] # Vmstat23procs -... summary: 1. vmstat: monitor and analyze the memory information, processes, and CPU of the operating system # vmstat 2 3 updates and outputs every two seconds, and stops after three counts. [Root @ MYDB1 ~] # Vmstat 2 3 procs ----------- memory ---------- --- swap -- ----- io ---- system -- ----- cpu ----- r B swpd free buff cache si so bi bo in cs us sy id wa st 0 0 0 170688 171224 464808 0 0 0 1 14 7 0 0 0 0 0 0 0 100 170680 171224 0 0 0 0 12 12 0 0 0 0 0 0 0 0 464828 100 0 0 0 0 0 0 0 0 13 37 0 0 100 0 Procs: r number of CPU time slice processes; B number of processes waiting for resources. Memory: The size of swpd Memory swap zone. as long as si and so are 0 for a long time, it will not be affected. Free physical memory; buff memory buffer; cache, as long as the bi is small, it is normal. Swap: memory transferred from si disk to memory; so memory to disk. if so and si are too large for a long time, the memory needs to be increased. IO: disk read/write status; total number of bi reads from the device; total number of bo writes to the device. the reference value of bi + bo is 1000, which means there is a problem with IO. System: number of interruptions during the collection interval. The number of In interruptions per second; the number of context switches generated by cs per second. the larger the two are on duty, the more CPU time the kernel consumes. Cpu: the CPU consumption time ratio of the us process. The higher the value, the more CPU consumption time. if the CPU consumption time exceeds 50% for a long time, the optimization process or algorithm is required. the Cpu consumption time ratio of the sy kernel is also required. When the number of Us + sy exceeds 80%, the CPU resources are insufficient. Id CPU idle time ratio; wa indicates the CPU time ratio occupied by IO wait. the higher the wa, the more serious the IO. The Wa reference value is 20%. if the value exceeds 20% for a long time, the IO problem is serious. 2. sar can obtain the CPU, running queue, disk IO, paging (swap zone), memory, CPU interruption, and network of the system. # Sar-u 3 2: every three seconds. count twice [root @ MYDB1 ~] # Sar-n DEV 3 2 Linux 2.6.32-279.19.1.el6.x86 _ 64 (MYDB1) 03/09/13 _ x86_64 _ (1 CPU) 18:00:50 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s18: 00: 53 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.0018: 00: 53 eth0 4.00 0.00 0.29 0.00 0.00 0.00: 00: 53 eth1 0.0018 0.33 0.00 0.02 0.00 0.00: 00: 53 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s18: 00: 56 lo 0.00 0.00 0.00 0.00 0.00 0. 00 0.0018: 00: 56 eth0 2.66 0.33 0.21 0.15 0.00: 00: 56 eth1 0.00 0.0018 0.66 0.00 0.04 0.00 0.00 Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/sAverage: lo 0.00 0.00 0.00 0.00 0.00 0.00 Average: eth0 3.33 0.17 0.25 0.08 0.00 0.00 0.00 Average: eth1 0.50 0.00 0.03 0.00 0.00 0.00 parameter:-A All devices;-u all CPUs;-P specified CPU;-d hard disk; -r memory sampling;-B memory buffer sampling;-v process, File, node, and lock table status;-n network;-q queue;-R process;-y terminal Slave;-W system Swap-o filename put command results in binary format in the file; 3. iostat (Sysstat needs to be installed), mainly for disk IO disk monitoring. # Iostat-d 2 3 [root @ MYDB1 ~] # Iostat-d 2 3 Linux 2.6.32-279.19.1.el6.x86 _ 64 (MYDB1) 03/09/13 _ x86_64 _ (1 CPU) Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 0.16 0.19 2.28 531210 0.29 6494604dm-0 0.18 2.28 522090 0.00 6494552dm-1 0.00 0.00 2376 0 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 0.00 0.00 0.00 0.00 0 0dm-0 0.00 0.00 0.00 0 0dm-1 0.00 0.00 0 0 Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtnsda 0. 00 0.00 0.00 0 0dm-0 0.00 0.00 0.00 0 0dm-1 0.00 0.00 0.00 0 0Blk_read/s: number of data blocks read per second Blk_wrtn/s number of data blocks written per second Blk_read number of all blocks Blk_wrtn write parameters:-c displays CPU usage;-d disk; -k is measured in KB.-t indicates the execution start time.-x device indicates the disk name. 4. free memory monitoring # free-m (in Mb) [root @ MYDB1 ~] # Free-m total used free shared buffers cachedMem: 995 829 166 0 167 453-/+ buffers/cache: 208 787 2015 Swap: 2015 0 experience value: the memory available for the application/physical system memory is greater than 70%, indicating excellent performance. <20% is that resources are insufficient and memory needs to be increased. It is normal between the two numbers. 5. uptime # uptime [root @ MYDB1 ~] # Uptime 18:17:59 up 33 days, :30, 3 users, load average: 0.00, 0.00, 0.00 system time, start time, number of logon users, average load in 1 minute, 5 minutes, and 15 minutes. Generally, the Load average cannot be greater than the number of CPUs. if the Load average is greater than the number of CPUs for a long time, the CPU is very busy. you need to optimize the program or increase the CPU. 6. netstat: network connection, running Port, route table, etc. # netstat-I [root @ MYDB1 ~] # Netstat-iKernel Interface tableIface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP Flgeth0 1500 0 5295771 0 0 0 114725 0 0 0 0 BMRU parameters:-a all the connections and ports; -n valid connections and ports;-r route table;-s protocol statistics;-v and n are similar;-t TCP protocol;-u UDP protocol; -I: The interface status automatically configured;-l LISTEN status;-p: The PID process, and-c: the second. Iface: Interface name MTU: maximum transmission unit, in bytes RX-OK/TX-OK: correct packet RX-ERR/TX-ERR: generated error RX-DRP/TX-DRP: dropped packet RX-OVR/TX-OVR: the larger the number of dropped or dropped packets, the larger the network problem. 7. top # topPID user pr ni virt res shr s % CPU % mem time + COMMAND 1 root 20 0 19228 1520 1232 S 0.0 0.1. 49 init 2 root 20 0 0 0 S 0.0 0.0. 02 kthreadd 3 root RT 0 0 0 S 0.0 0.0. 00 migration/0 Parameter:-d interval;-I does not show dead or idle processes;-c command path;-s safe mode running;-B split screen output, can be combined with-n to output to the document;-n to output the number of times, exit after completion. PR: priority NI: nice value, high negative duty priority, positive opposite VIRT: total virtual memory used, unit KBRES: occupied memory, unit KBSHR: Shared memory size, unit: KBTIME +: total CPU time used, unit: 1/100 seconds COMMAND: COMMAND name or path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.