10.6 Monitoring IO Performance
- The stat section explains:
D a process that cannot be interrupted
The process of R run state
The process of the S sleep state
T paused process
Z Zombie Process
< high-priority processes
N Low-priority processes
Memory paging is locked in memory
S master Process
L Multithreading Process
+ Foreground Process
10.9 Viewing network status
- The netstat command can be used to view network status information.
- Common usage:
NETSTAT-LNP---> View listening ports ( focus on active Internet connections (only servers)
Netstat-an---> View the status of the network connection of the system (with a focus on state status of established, typically within 1000 of the state, too large to focus on troubleshooting)
Option meaning:
-A: Shows all sockets in the connection
-L: Displays the socket of the server in the monitor
-N: Use the IP address directly, not through the domain name server
-P: Shows the program identification code and program name of the socket being used
- Tips:
Count the number of connections currently in various states of the system:
Netstat-an | awk '/^tcp/{++sta[$NF]}end{for (key in STA) print key, "\ T", Sta[key]} '
Add:
Ss-an and Netstat use similar. 10.10 Linux under Grab Bag
- The tcpdump command is used to crawl network packets, which can print header information for all packets that pass through the network interface, or you can use the-w option to save the packet to a file for later analysis.
- Common usage:
Tcpdump-nn-i ENS33---> Crawl packets that pass through the NIC Ens33
Tcpdump-nn Port 80-i Ens33---> Crawl 80-Port packets
Tcpdump-nn not port, and host 192.168.1.100---> Crawl non 22 ports and packets from IP 192.168.1.100
TCPDUMP-NN-C 100-w/tmp/1.cap---> Crawl 100 package and save to file/tmp/1.cap
Tcpdump-r/tmp/1.cap---> Reading files/tmp/1.cap
- The Tshark command is used to crawl and analyze network packets.
The Wireshark package must be installed before using the Tshark command
Yum Install-y Wireshark
Tips:
Displays the domain name and URI of the access HTTP request:
Tshark-n-T a-r http.request-t fields-e "Frame.time"-E "ip.src"-E "http.host"-E "Http.request.method"-E "http.requ Est.uri "
Extended Knowledge:
The TCP protocol's three-time handshake four-time wave mechanism simple principle ( related knowledge from the network, thanks to the original author ).
- Three-time handshake:
1.A initiates A connection request to B: A--->b
2.B receives a send signal and sends a confirmation message to a: B--->a
3.A receives a confirmation signal from B and sends a confirmation signal to B: A--->b
With the first handshake, B knows that a can send data.
With a second handshake, a knows that B can send data.
In combination with the first, two handshakes, a knows that B can receive data.
In combination with the third handshake, B knows that a can receive data.
- Four times wave:
1.A initiates a request to B, indicating that a has no data to send: a--->b
2.B sends a signal to a to confirm the disconnect request for a: B--->a
3.B sends a signal to a, requests disconnect, indicates b no data to send: b--->a
4.A Send confirmation signal to B, agree to disconnect: A--->b
Why is the 2nd, 3 waves not in a wave? Because at this point a although no longer send the data, but also can receive data, B may also have data to send to a, so two waves can not be combined to one time.
The number of waves is more than a handshake, because the handshake process, communication only need to deal with the connection. And the wave process, communication in addition to processing the connection, but also processing data.
2018-1-23 Linux Learning notes