In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what are the CentOS command line performance testing tools?". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Uptime
The display of the Uptime command includes how long the server has been running, how many logged-in users, and an overall assessment of server performance (load average). The load average value records the load during the last 1-minute, 5-minute, and 15-minute intervals, respectively. Load average is not a percentage, but the number of processes waiting in the queue for execution. If the process requires CPU time to be blocked (meaning that CPU does not have time to process it), the load average value will increase. On the other hand, if each process can get the time to access CPU immediately, this value will be reduced.
The optimal value of load average under UP kernel is 1, which means that each process can be processed by CPU immediately, of course, a lower level will not be a problem, only that part of the resources are wasted. However, this value is also different between different systems. For example, for a single CPU workstation, a load average of 1 or 2 is acceptable, while in a multi-CPU system, this value should be divided by the number of physical CPU. If the number of CPU is 4 and the load average is 8 or 10, the result is just more than 2.
You can use uptime to determine whether a performance problem occurs on the server or on the network. For example, if a network application does not perform well, run uptime to check whether the system load is high, if not this problem is more likely to occur on your network.
II. Top
The Top command shows the actual CPU usage, which, by default, displays the task information that occupies CPU on the server and is refreshed every 5 seconds. You can classify them in a variety of ways, including PID, time, and memory usage.
The following is an introduction to the output values:
Quote
PID: process identity
User name of the owner of the USER; process
PRI: priority of the process
NI:nice level
SIZE: the amount of memory consumed by the process (code + data + stack)
Amount of physical memory used by the RSS; process
SHARE; the amount of memory shared by this process and other processes
STAT: state of the process: s = dormant state, R = running state, T = stopped state, D = interrupted hibernation state, Z = zombie state
% CPU: shared CPU usage
% MEM; shared physical memory
TIME: the time that the process takes up the CPU
COMMAND: command line to start the task (including parameters)
Priority and nice level of the process
Process priority is a parameter that determines the priority in which processes are executed by CPU, and the kernel adjusts this value as needed. The Nice value is a restriction on priority. The value of the process priority cannot be lower than the nice value. (the lower the nice, the higher the priority)
The process priority cannot be changed manually, only by changing the nice value to adjust the process priority indirectly. If a process runs too slowly, you can allocate more CPU resources to it by specifying a lower nice value. Of course, this means that other processes will be allocated fewer CPU resources and run more slowly. Linux supports a range of nice values from 19 (low priority) to-20 (high priority), and the default value is 0. If you need to change the nice value of a process to a negative number (high priority), you must log in to the root user using the su command. Here are some examples of commands that adjust nice values
Start the program xyz with a nice value of-5
# nice-n-5 xyz
Change the nice value of a running program
# renice level pid
Change the nice value of a process with a pid of 2500 to 10
# renice 10 2500
Zombie process
When a process is finished, it usually takes some time to complete all tasks (such as closing open files) before it ends. In a short period of time, the process is in a zombie state. After the process completes all shutdown tasks, it submits its shutdown information to the parent process. In some cases, a zombie process cannot shut itself down, and the process state is z (zombie). You cannot use the kill command to kill a zombie process because it is already marked "dead". If you can't get rid of a zombie process, you can kill its parent process, and the zombie process disappears. However, if the parent process is an init process, you cannot kill the init process because init is an important system process, in which case you can only restart the server once to get rid of the zombie process. It is also necessary to analyze why applications lead to rigidity.
III. Iostat
Iostat is part of the sysstat package. Iostat shows the average CPU time since the system was booted (similar to uptime), it can also show the disk subsystem usage, and iostat can be used to monitor CPU utilization and disk utilization.
CPU utilization is divided into four parts:
Quote
CPU occupancy of% user:user level (application)
% nice: CPU occupancy of user level with nice priority
CPU usage of% sys:system level (kernel)
% idle: idle CPU resources
Disk occupancy has the following sections:
Quote
Device: block device name
Tps: the number of transmissions made by the device per second (Ipicuro requests per second). Multiple individual Iamp O requests can be grouped into a transport operation, because a transport operation can be of different capacity.
Blk_read/s, Blk_wrtn/s: the number of blocks read and written by the device per second. Blocks may be of different capacities.
Blk_read, Blk_wrtn: the total number of block devices read and written since the system was started.
Size of the block
Blocks may be of different capacities. The size of blocks is generally 1024, 2048, and 4048byte. Available through tune2fs or dumpe2fs:
Quote
[root@rfgz ~] # tune2fs-l / dev/hda1 | grep 'Block size'
Block size: 4096
[root@rfgz ~] # dumpe2fs-h / dev/hda1 | grep 'Block size'
Dumpe2fs 1.35 (28-Feb-2004)
Block size: 4096
IV. Vmstat
The Vmstat command provides the monitoring of the process, memory, page Imax O block and CPU and other information. Vmstat can display the average or sampling value of the test results, and the sampling mode can provide monitoring results of different frequencies in a sampling period.
Note: the errors that may occur in data collection need to be considered in the sampling mode. Setting the sampling frequency to a lower value can minimize the impact of errors.
The following describes the meaning of each column
Quote
Process (procs)
R: number of processes waiting for run time
B: processes in an uninterruptible sleep state
W: processes that are swapped out but can still be run, this value is calculated
Memoryswpd: the amount of virtual memory
Free: the amount of free memory
Buff: the amount of memory used as a buffer
Swap
Si: the number swapped from the hard disk
So: the number swapped to the hard disk
IO
Bi: the number of blocks output to a block device
Bo: the number of blocks accepted from a block device
System
In: the number of interrupts per second, including the clock
Cs: the number of context switches occurring per second
Cpu (percentage of total cpu elapsed time)
Us: time for non-kernel code to run (user time, including nice time)
Sy: time for kernel code to run (system time)
Id: idle time. In kernel versions prior to Linux 2.5.41, this value includes Imax O wait time.
Wa: the time to wait for the Linux O operation, which was 0 in kernel versions prior to Linux 2.5.41
The Vmstat command provides a large number of additional parameters, and here are a few very useful parameters:
Quote
M: displays the memory utilization of the kernel
A: displays memory page information, including active and inactive memory pages
N: displays the header line, which is useful when using sampling mode and outputting the command results to a file. For example, root#vmstat-n 2 10 displays 10 output at a frequency of 2 seconds
When using-p {Partition}, vmstat provides statistics on the results of Imax O
5. Ps and pstree
The ps and pstree commands are the most commonly used basic commands for system analysis. The ps command provides a list of running processes, and the number of processes listed depends on the parameters attached to the command. For example, the ps-A command lists all processes and their corresponding process ID (PID), which you must know before using some other tool, such as pmap or renice.
On systems running java applications, the output of the ps-A command can easily exceed the display range of the screen, making it difficult to get complete information about all processes. At this point, using the pstree command, you can display all the process information in a tree structure and integrate the information of the child processes. The Pstree command is useful for analyzing the source of the process.
VI. Numastat
With the continuous development of NUMA architecture, such as eServer xSeries 445 and its successor, eServer xSeries 460, NUMA architecture has become the mainstream of enterprise data centers. However, the NUMA architecture faces new challenges in terms of performance tuning, such as memory allocation issues that were of no interest before the NUMA system, and the Numastat command provides a tool to monitor the NUMA architecture. The Numastat command provides a comparison of local and remote memory usage and the memory usage of each node. The Numa_miss column shows the local memory that has failed to be allocated, and the numa_foreign column shows the information about the allocation of remote memory (slow access). Too many calls to remote memory will increase the latency of the system and affect the performance of the whole system. Making processes running on a node access local memory will greatly improve the performance of the system.
The system I use does not support NUMA architecture. This is a screenshot of the original document.
7. Sar
The sar program is also part of the sysstat installation package. The sar command is used to collect, report, and save information about the system. The Sar command consists of three applications: sar, which uses and displays data, and sa1 and sa2, which is used to collect and store data. By default, automatic collection and analysis are added to crontab:
Quote
[root@rfgz ~] # cat / etc/cron.d/sysstat
# run system activity accounting tool every 10 minutes
* / 10 * root / usr/lib/sa/sa1 1 1
# generate a daily summary of process accounting at 23:53
53 23 * root / usr/lib/sa/sa2-A
The data generated by the sar command is saved in the / var/log/sa/ directory, and the data is saved according to time, and the corresponding performance data can be queried according to the time.
You can also use sar to get a real-time execution result from the command line, and the data collected can include CPU utilization, memory pages, network IBO, and so on. The following command indicates that it is executed 5 times with sar, with an interval of 3 seconds:
VIII. Free
The free command shows all memory usage on the system, including free memory, used memory, and swapped memory space. The Free command display also includes some information about caches and buffers used by the kernel.
When using the free command, you need to keep in mind the memory structure of linux and the management of virtual memory, such as the limit of the amount of free memory, and the use of swap space does not mark a memory bottleneck.
Useful parameters for the Free command:
Quote
The results are displayed according to bytes, kilobytes, megabytes and gigabytes, respectively.
-l display low and high memory differently
-c {count} the number of times free output is displayed
IX. Pmap
The pmap command shows the amount of memory used by one or more processes, and you can use this tool to determine which processes on the server take up too much memory and cause memory bottlenecks.
10. Strace
Strace intercepts and records the system call information of the process, as well as the command signals received by the process. This is a useful diagnostic and debugging tool, and system administrators can use strace to solve program problems.
Command format, you need to specify the process ID to be monitored. This is mostly used by developers.
Strace-p
11. Ulimit
You can control the use of system resources through ulimit. Look at the previous log: use ulimit and proc to adjust system parameters
12. Mpstat
The mpstat command is also part of the sysstat package. The Mpstat command is used to monitor each available CPU in a multi-CPU system. The Mpstat command can display the operation of each CPU or all CPU, and it can also use parameters to monitor the sampling results at a certain frequency as the vmstat command does.
This is the end of the content of "what are the CentOS command line performance testing tools". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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
© 2024 shulou.com SLNews company. All rights reserved.