Linux environment common performance monitoring and assistance development debugging tools (attached tcpdump common use)

Source: Internet
Author: User
Tags server memory

Linux There are many excellent tools to help us analyze the server performance indicators and assist in the development of debugging work. The following is only a list of commands that are relatively basic and are generally integrated in a Linux environment without having to be installed again. For more detailed commands, refer to Https://github.com/brendangregg/perf-tools

A ,CPU process -relatedCommon tools listed below: Uptime,PS,top,mpstat, Pidstat , etc. uptime: Check system uptime, average load, etc. Load>#  ofCPUs MaymeanCPUsaturation PS: To see the percentage of CPU resources that a process consumes; top/htop/atop: The displayed information is close to PS , but top can understand the CPU consumption, can update the display according to the time specified by the user; mpstat: Can view the average information of all CPUs , and also can view the information of the specified CPU ; Pidstat: This is useful for displaying the state of a process, time-consuming, and so on.

B, memory-related Common tools:free,vmstat Free: You can see the total number of memory, used, idle memory,swap use ( swap devices are used when the system does not have enough physical memory to handle all requests),swap The device can be a file, or it can be a disk partition. But be careful, the cost of using swap is very high. If the system does not have physical memory available, it will frequently swapping, if the swap device and the program is going to access the data on the same file system, it will encounter serious IO problems, resulting in the entire system is slow, Even crashes) situations, especially remind that if the swap is used more, the server memory is not enough ; vmstat: Monitors virtual memory usage, free memory, buffering,cache , and other metrics, similar to the.
C, disk I/O related Common tools:iostat,fio, Swapon Iostat: Can obtain the number of read and write data blocks per second, all read and write blocks, etc., can have a general understanding of disk Read and write performance, and can simulate the sequence and random read and write disk operations; Fio: Another powerful io pressure testing tool, the most important feature of this tool is that it is easy to use and supports a very large number of files that can be overwritten with the way we can see the use of files. swapon: Displays the swap device usage, if you start the swap device.

D, network I/O related Common tools:netstat,tcpdump,Route,iptarf,netperf, Nicstat, Ping/traceroute netstat: is a very useful tool for monitoring TCP/IP network, it can display the routing table, the actual network connection and the status information of each network interface device; tcpdump: A packet header for monitoring TCP/IP connections and directly reading the data link layer. You can specify which packets are monitored and which control to display the format; Route: You can set up a static route for the NIC configured for the ifconfig command, display and modify the Entry Network command in the local IP routing table; iptarf: Can be used to view the throughput of the local network, to obtain the network transmission rate; netperf: Can simulate the server and client network transceiver, test network throughput size; iperf: Similar to netperf, analog server and client network send and receive, test maximum TCP and UDP bandwidth performance, can provide network throughput rate information , and statistics such as vibration, packet loss rate, maximum segment and maximum transmission unit size. Nicstat: monitors the status of network interfaces such as throughput, etc., similar to the IOSTAT output format. ping/traceroute: More common, check whether the network is unblocked.
E. Common tools for development testing:readelf,hexdump/xxd,od,objdump,nm,telnet/nc

readelf: Display the elf file format in a readable manner, including (target file/executable/shared library)

hexdump/xxd: Print the contents of the file as 16 binary

od: Optional Print file contents

objdump: Disassembly of machine instructions

nm: List symbols of target files

TELNET/NC : Testing the network connection client


F, trace Debugging related Common tools: Strace, Ltrace, Dtrace/ftrace, Blktrace strace: Tracing the system call time, error message, parameter passing, etc. of the running process. ltrace: The time-consuming, error message, parameter passing, etc. of the function library call that tracks the running process. dtrace/ftrace: The synthesis of the above two tools. DTrace is a tracing tool whichruns at the system level-this means you can trace all processes to intoand out of the kernel, rather than selecting a single process to trace. blktrace: Block I/O event Tracer

G, Chatty's comprehensive tool :Sar/collectl, Dstat, view/proc/pid/xxx various information, SYSCTL,/sys various information


Appendix: tcpdump Common Use way

Using the root User:

Tcpdump TCP port port number-x-s 0-i eth1
Tcpdump host Machine Ip-x-S 0-i eth1

tcpdump host machine IP and TCP port port number-x-s 0-i eth1

Instructions for use:

Monitoring packets for a specified network interface

Tcpdump-i eth1

If you do not specify a network card, the default tcpdump will only monitor the first network interface, typically eth0, and the following example does not specify a networking interface.

Monitoring packets for a specified host

Print all packets entering or leaving the sundown.

Tcpdump Host Sundown

You can also specify IP, such as intercepting all packets received and emitted by all 210.27.48.1 hosts

Tcpdump host 210.27.48.1

Print packets that Helios and hot or communicate with Aces

Tcpdump host Helios and \ (hot or ACE \)

Intercept host 210.27.48.1 and host 210.27.48.2 or 210.27.48.3 communication

Tcpdump host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \)

Prints the IP packets that the ACE communicates with any other host, but does not include packets between the Helios.

Tcpdump IP host ace and not Helios

If you want to get host 210.27.48.1 in addition to the IP packets that communicate with all hosts except host 210.27.48.2, use the command:

Tcpdump IP host 210.27.48.1 and! 210.27.48.2

Intercept all data sent by host hostname

Tcpdump-i eth0 SRC host hostname

Monitor all packets sent to host hostname

Tcpdump-i eth0 DST host hostname


Reference: Https://github.com/brendangregg/perf-tools
http://crtags.blogspot.com/2012/04/dtrace-ftrace-ltrace-strace-so-many-to.html
https://danielmiessler.com/study/tcpdump/


Linux environment common performance monitoring and assistance development debugging tools (attached tcpdump common use)

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.