Linux organize notes

Organizing notes on Linux

Get server information

Note: Total number of cores = Number of physical CPUs * Number of cores per physical CPU Total number of logical CPUs = Number of physical CPUs * Number of cores per physical CPU * Number of hyperthreads

CPU related operations

(1) Check the number of physical CPUs

cat /proc/cpuinfo| grep “physical id”| sort| uniq| wc -l

(2) Check the number of cores in each physical CPU (i.e. the number of cores)

cat /proc/cpuinfo| grep “cpu cores”| uniq
Insert image description here

(3) Check the number of logical CPUs

cat /proc/cpuinfo| grep “processor”| wc -l
Insert image description here

(4) Check Linux version information

uname -a View kernel information
Insert image description here
cat /etc/redhat-release View release version information
Insert image description here

(5) Check server memory

free -g
Insert image description here
total: total memory
used: used
free: not used
shared: total memory shared by multiple processes
-buffers/cache: used memory
+buffers/cache: available memory
available memory=free+buffers+cached(642 =67+217+357)

(6) Check server hard disk usage

Check the disk space usage of the file system

df -lh
Insert image description here
to view hard disk and partition information
fdist -l
to view hard disk I/O performance
Note: -d displays disk status, -x displays expansion data related to io, -k is in KB, 10 means refresh every 10 seconds Once, 2 means refresh 2 times, the default is always refresh
iostat -d -x -k 10 2
Insert image description here
parameter description:
rrqm/s: How many read requests related to this device are merged per second (when the system call needs to read data At this time, the VFS sends the request to each FS. If the FS finds that different read requests read the data of the same block, the FS will merge the requests into Merge) wrqm/s: The number of merge
write operations per second
r/s : The number of reads from the I/O device completed per second
w/s: The number of writes to the I/O device completed per second
rkB/s: How many KB read per second
wkB/s: How many KB written per second
avgrq-sz : average data size (sectors) of each device I/O operation
avgqu-sz: average I/O queue length
await: average waiting time of each device I/O operation ms
svctm: average each device I/O operation Time ms
%util: More than 100% of one second is used for I/O operations.
Usually, you only need to pay attention to the two parameters %util and await. The
closer %util is to 100%, the more I/O requests are generated. The easier it
is to wait at full load. It depends on svctm. It is best to be lower than 5ms. If it is greater than 5ms, it means that the I/O pressure is high. You can consider replacing the hard disk with a faster response speed.

(7) Use vmstat to monitor the overall performance of the Linux system

vmstat 1 4 ##Once per second, four times in total.
Insert image description here
Parameter introduction:
 procs:
r: number of processes waiting to run
b: number of processes in non-interruptible sleep state    
 memory:
swpd: virtual memory usage (KB)
free: free memory (KB)
 swap:
si: swapped from disk to memory Number of swap pages
so: number of swap pages swapped from memory to disk
io:
bi: number of blocks sent to the device (blocks/s)
bo: number of blocks received from the block device (blocks/s)
 system:
in: per second Number of interrupts
cs: number of environment context switches per second
cpu: (percentage of total cpu usage)
us: cpu usage time
sy: cpu system usage time
id: idle time
The values ​​of r and b under standard conditions should be: r<5, b is about 0.
If us+sy<70%, the system performance is good.
If us+sy>85, the system performance is bad.

(8) Check the number of system digits

Check system 32 and 64 bit

getconf LONG_BIT
Insert image description here

(9) View related modules that have been loaded in the system

lsmod
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_38717886/article/details/114915976