In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
Command w
[root@ceshi ~] # w
09:03:29 up 8:14, 1 user, load average: 0.10, 0.20, 0.30
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
Root pts/0 192.168.134.1 09:02 0.00s 0.00s 0.00s w
Mainly analyze the red font, indicating that CPU load 0.10 means one minute cpu load. Generally, this value cannot be greater than the number of cpu cores and greater than the number of cpu cores. For example, one core means that the cpu load is a little high, 0.20 means five minutes cpu load, and 0.30 means 15 minutes cpu load.
Check the number of CPU cores: red font, 0 for single core, 1 for dual core
[root@ceshi ~] # cat / proc/cpuinfo
Processor: 0
Vendor_id: GenuineIntel
Cpu family: 6
Model: 69
Model name: Intel (R) Core (TM) i5-4200U CPU @ 1.60GHz
Command uptime
It's similar to the w command.
[root@ceshi ~] # uptime
09:05:57 up 1 min, 1 user, load average: 0.21, 0.09, 0.03
Command vmstat
When you use the w command to see that the cpu load is a little high for a minute, analyze where it is being used. Use this command to analyze
[root@feiji ~] # vmstat
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 3516 69292 196588 513076 0 0 0 25 1 2 0 099 0 0
[root@feiji ~] # vmstat 1 5 # shows once per second for a total of five times
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 3516 68920 196588 513480 0 0 0 25 1 20 099 0 0
0 0 3516 68904 196588 513480 0 0 0 166 275 1 198 0 0
0 0 3516 68780 196588 513480 0 0 0 124 179 317 0 099 1 0
00 3516 68780 196588 513480 00 00 170 301 0 0100 00
0 0 3516 68780 196588 513484 0 0 0 184 293 2 197 0 0
[root@feiji ~] # vmstat 2 # always monitor and display every two seconds
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 3516 67928 196592 514288 0 0 0 25 1 2 0 099 0 0
0 0 3516 67920 196592 514296 0 0 0 134 214 0 199 0 0
R (running, run): represents the number of processes running and waiting for cpu time slices. If the number of server cpu is larger than the number of server cpu for a long time, it means that there is not enough cpu.
B (block, blocking): indicates the number of processes waiting for resources
Swpd: the amount of virtual memory that has been used. If it is greater than 0, your machine is out of physical memory. If it is not the cause of the program memory leak, then you should upgrade the memory or migrate the memory-consuming tasks to other machines.
Free: the size of the free physical memory
Buff:Linux and unix systems are used to store what is in the directory, permissions and so on are cached.
Cache:cache is directly used to remember the files we open, buffer the files, and use part of the free physical memory to cache files and directories, in order to improve the performance of program execution. When the program uses memory, buffer/cache will be used quickly.
Si: the amount of virtual memory read from disk per second. If this is greater than 0, the physical memory is insufficient or the memory is leaked. To find the memory process to solve it, my machine has plenty of memory and everything is fine.
So: the amount of virtual memory written to disk per second. If this value is greater than 0, it is the same as above
Bi: the amount of data read from the block device (read disk)
Bo: the amount of data written from the block device (write disk)
Bi: the number of blocks received by block devices per second. The block devices here refer to all disks and other block devices on the system. The default block size is 1024byte, so there is no IO operation on my computer, so it has always been 0, but I have seen that it can reach 140000amp s on a machine that handles copying a large amount of data (2-3T), and the disk write speed is about 140m per second.
Bo: the number of blocks sent by a block device per second. For example, if we read a file, the bo should be greater than 0. Bi and bo are generally close to 0, or IO is too frequent and needs to be adjusted.
Si: from swap partition to memory, so: from memory to swap partition; bi: from hard disk to memory, bo: from memory to hard disk
Whether this is correct or not: the values of si and so and swpd have been increasing, indicating that there is not enough memory because some data in memory is being swapped out. The large bi bo value means that the hard disk is read and written frequently, and then the IO bottleneck of the hard disk is explained. Consider display card or solid state disk, reduce magnetic disk IO operation
Cs: the number of context switches per second. For example, when we call a system function, we need to switch context, and when we switch threads, we also need to switch the process context. This value should be as small as possible, too large. Consider reducing the number of threads or processes. For example, in web servers such as apache and nginx, we usually do thousands or even tens of thousands of concurrency tests when doing performance tests. The process that selects the web server can be downgraded by the peak of the process or thread, pressure test, until cs reaches a smaller value, this process and
The number of threads is a more appropriate value. The same is true of system calls. Every time a system function is called, our code will enter the kernel space, resulting in context switching, which is very resource-consuming, and we should try our best to avoid frequent calls to system functions. Table with too many context switches
Show that most of your CPU is wasted on context switching, resulting in less time for CPU to get serious, and it is not advisable for CPU to be underutilized.
Us: the percentage occupied by cpu. If this is greater than 50, we need to find out why. Let's see which process occupies cpu.
Us: user CPU time, I used to be on a server that does encryption and decryption frequently, and I can see that the us is close to 100 and the running queue reaches 80 (the machine is doing stress testing and the performance is not good).
Sy: system CPU time. If it is too high, it means a long system call time, for example, frequent IO operations.
Id: idle CPU time. Generally speaking, id + us + sy = 100. generally speaking, I think id is idle CPU utilization, us is user CPU utilization, and sy is system CPU utilization.
Wt: wait for IO CPU time.
Command top
When using the w or vmstat command, check the system load, and top can analyze which process occupies high cpu
Display every three seconds, press Q to exit
Usage: top-bn1 # statically shows the load of the process, which can be written into the script
[root@feiji ~] # top
Top-19:01:55 up 170days, 8:15, 1 user, load average: 0.00,0.01 up 0.00
Tasks: 98 total, 2 running, 96 sleeping, 0 stopped, 0 zombie
Cpu (s): 0.3%us, 0.7%sy, 0.0%ni, 98.7%id, 0.3%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1030600k total, 980784kused, 49816k free, 196864k buffers
Swap: 2097148k total, 3516kused, 2093632k free, 530960k cached
PIDUSER PR NI VIRT RES SHR S CPU MEM TIME+ COMMAND
15624 root 20 0 7056 5904 432 S 0.3 0.6 135:18.16 sap1002
15627 root 20 0 31464 12m 664 R 0.3 1.3 282:13.96 sap1005
1root 20 0 2900 936 796 S 0.0 0.1 0:10.05 init
2root 20 00 00 S 0.0 0.00: 00.00 kthreadd
3root RT 00 00 S 0.0 0.00: 00.00 migration/0
4root 20 0 0 0 S 0.0 0.0 0:56.08 ksoftirqd/0
You can see the cpu load, memory usage used, free memory free, and buffers,cached in the first few lines
Below are PR (0Murray 39) and NI (- 20Murray 19)
VIRT: virtual memory
RES: real memory
SHR: shared memory
% CPU: percentage of cpu occupied
% MEM: percentage occupied memory
COMMAND: specific process
Command sar
View network card traffic
The first step is to install
Yum install-y sysstat
Just now, "cannot open / var/log/sa/sa08: there is no file or directory" may be displayed. It will take 10 minutes to display normally.
[root@feiji] # sar-n DEV
Linux 2.6.32-504.30.3.el6.i686 (feiji) November 08, 2016 _ i6861CPU)
20:20:01 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
20:30:01 lo 0.13 0.13 0.01 0.01 0.00 0.00 0.00
20:30:01 eth0 1.35 1.40 0.15 0.22 0.00 0.00 0.00
Average time: lo 0.13 0.13 0.01 0.01 0.00 0.00 0.00
Average time: eth0 1.35 1.40 0.15 0.22 0.00 0.00 0.00
Among them, we mainly look at the rxkB/s (entry port) and txkB/s (exit port) of eth0 (external network port).
RxkB/s (amount of data collected per second)
TxkB/s (amount of data sent per second)
0.15kb/s / 1000 = 0.00015mb/s
The bandwidth is equal to 0.00015mb/s * 8bi t = 0.0013m
You should know that 1byt = 8bit
It is often said that the bandwidth unit of the network line is that the bandwidth of 10m bits has been multiplied by 8.
10 / 8 = 1.25 is its download speed.
Bit is the unit of input on the network card.
Computer units have bytes (byt), KB,MB,GB
Sar-Q # can view historical load
Sar-b # can view the current disk status
Sar-p # can view the usage of cpu
Command free
[root@feiji] # free-m
Total used free shared buffers cached
Mem: 1006 961 44 0 187 541
-/ + buffers/cache: 232 774
Swap: 2047 4 2043
Men represents memory, total represents total, used represents usage, and free represents remaining memory.
Look at the real remaining memory-/ + buffers/cache: free=744= 44, 187, 541.
The second part (- / + buffers/cache):
(- buffers/cache) used memory: 232m (refers to used-buffers-cached in the first part of the Mem line)
(+ buffers/cache) free memory: 774m (refers to free + buffers + cached in the first part of the Mem line)
Visible-buffers/cache reflects the memory actually eaten by the program, while + buffers/cache reflects the total amount of memory that can be misappropriated.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
CSCun95075-ASA drops packet due to nat-no-xlate-to-pat-pool after removing NAT ruleSymptom:Once a
© 2024 shulou.com SLNews company. All rights reserved.