Linux Learning Notes (30) daily operation and Maintenance II

Source: Internet
Author: User
Tags switches disk usage mysql view

One, Iostat, free
Iostat-x disk usage

RRQM/S: The number of read operations per second for the merge. Delta (rmerge)/s
WRQM/S: The number of write operations per second for the merge. Delta (wmerge)/s
R/S: Number of Read I/O devices completed per second. Delta (RIO)/s
W/S: Number of write I/O devices completed per second. Delta (WIO)/s
RSEC/S: Number of Read sectors per second. Delta (rsect)/s
WSEC/S: Number of Write sectors per second. Delta (wsect)/s
rkb/s: Reads K bytes per second. is half the rsect/s because the size of each sector is 512 bytes. (Calculation required)
wkb/s: Writes K bytes per second. is half the wsect/s. (Calculation required)
Avgrq-sz: The average data size (sector) per device I/O operation. Delta (rsect+wsect)/delta (Rio+wio)
Avgqu-sz: Average I/O queue length. That is Delta (AVEQ)/s/1000 (because the Aveq is in milliseconds).
Await: The average wait time (in milliseconds) for each device I/O operation. Delta (ruse+wuse)/delta (Rio+wio)
SVCTM: The average service time (in milliseconds) per device I/O operation. Delta (use)/delta (RIO+WIO)
%util: How much time in a second is spent on I/O operations, or how many times in a second I/O queues are non-empty. That is, the delta (use)/s/1000 (because the unit of use is milliseconds)
If%util is close to 100%, it indicates that there are too many I/O requests, the I/O system is full, and the disk may have bottlenecks.

Iotop disk usage
Yum Install-y iotop

Free to view memory usage
-B: Displays memory usage in bytes;
-K: Displays memory usage in kilobytes;
-M: Displays memory usage in megabytes;
-O: Do not display buffer adjustment columns;
-s< interval seconds;: Continuous observation of memory usage;
-T: Displays the sum of memory columns;
-V: Displays version information.

Buffer/cache differences
Formula: Total=used+free+buff/cache
Avaliable contains free and buffer/cache remaining parts
0000 (disk)-"memory (cache)---" CPU//cache
0000 (CPU)--"Memory (Buff)--" Disk//Buffer
Second, PS
PS View System process
Usage: PS aux, ps-elf


PS aux | grep mysql view MySQL process
Stat Section Description
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

Ls-l/proc/Process number/view where the process is located
threads and processes

threads appear to reduce the consumption of context switches, improve system concurrency, and break through a process that can only do the same thing, Makes it possible to be in-process concurrency.

The

assumes that a text program needs to accept keyboard input, display content on the screen, and save information to the hard disk. If there is only one process, it is bound to cause the same time only the embarrassment of doing the same thing (when saved, you can not enter content through the keyboard). If there are multiple processes, each process is responsible for a task, process A is responsible for receiving keyboard input tasks, and process B is responsible for displaying the content on the screen, and process C is responsible for saving the contents to the hard disk. The collaboration between the process a,b,c involves the process communication problem, and there is something that we all need to have ——-text content, constantly switching to cause loss of performance. If there is a mechanism, you can make the task A,b,c share resources, so that context switches need to save and restore less content, but also reduce the performance of the communication caused by the loss, it is good. Yes, this mechanism is a thread. The
thread is also called a lightweight process, which is a basic CPU execution unit and the smallest unit in the program execution, consisting of a thread ID, a program counter, a register collection, and a stack. The introduction of threads reduces the overhead of program concurrency and improves the concurrency performance of the operating system. The thread does not have its own system resources. A
process is a program on a computer that has a running activity on a data set, which is the basic unit of the system's resource allocation and scheduling, and is the basis of the operating system structure. Or a process is a program with a certain set of independent functions on a data collection of a running activity, the process is the system for resource allocation and scheduling of an independent unit. A
thread is an entity of a process that is the basic unit of CPU dispatch and dispatch, which is a smaller unit that can run independently than a process.
Process and thread relationships:
(1) A thread can belong to only one process, while a process may have multiple threads, but at least one thread. The
(2) resource is allocated to the process, and all the threads of the same process share all the resources of the process. The
(3) CPU is assigned to a thread, that is, a thread that is actually running on the CPU.
Third, view network status

netstat view network status
NETSTAT-LNP view listening ports

Netstat-an View System network connectivity

NETSTAT-LNTP only see TCP, does not include socket

Ss-an and Nestat but SS does not show process name
share a little trick:

 netstat -an | awk ‘/^tcp/ {++sta[$NF]} END {for(key in sta) print key,"\t",sta[key]}‘

See how many of these states are
Established need special attention, if particularly large, it means that the system is busy

The difference and introduction between TCP and UDP
http://blog.csdn.net/li_ning_/article/details/52117463
TCP three handshake and four breakup
Https://www.cnblogs.com/leezhxing/p/4524176.html

Iv. Grasping the bag

yum install -y tcpdump抓包工具tcpdump 用法:tcpdump -nn tcpdump -nn -i ens33  tcpdump -nn port 80     //指定端口80 tcpdump -nn not port 22 and host 192.168.0.100  //指定host和端口不是22tcpdump -nn -i ens33 -c 10 -w /tmp/1.cap   //  抓10个包放入1.cap中,可以用file命令查看信息tcpdump -r   /tmp/1.cap  //读取抓到的包信息 tshark -n -t a -R http.request -T fields -e "frame.time" -e "ip.src" -e "http.host" -e "http.request.method" -e "http.request.uri"  yum install -y wireshark

Tcpdump-nn-i Ens33
The first n is the IP, the second n is the port number
Display hostname and SSH without writing n

Linux Learning Notes (30) daily operation and Maintenance II

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.