Detailed explanation of Linux server status and performance related commands

Detailed explanation of Linux server status and performance related commands

Server Status Analysis

View Linux server CPU details

#View CPU information

[root@host ~]# cat /proc/cpuinfo

# View the number of physical CPUs

[root@host /]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l

# View the number of cores of each physical CPU

[root@host /]# cat /proc/cpuinfo | grep "cpu cores" | uniq

#Number of logical CPUs (logical CPU = number of physical CPUs * number of cores)

[root@host /]# cat /proc/cpuinfo | grep "processor" | wc -l

Check the memory status of Linux server

# Check memory usage

[root@host ~]# free -m 
total used free shared buffers cached 
Mem: 372 256 115 0 17 158 
-/+ buffers/cache: 81 290 
Swap: 509 0 509

>total: total memory

>user: Amount of memory used

>free: free memory

> shared: the number of multi-process shared memories

>buffers: number of buffer memories

>cached: cache memory

Available memory = free+buffers+cached

Used memory = used-buffers-cached

swap The amount of swap memory. This item can be used to determine whether the memory is sufficient.

View Linux server hard disk usage

#View hard disk and partition information

fdisk -l

 [root@host ~]# fdisk -l 
Disk /dev/sda: 10.7 GB, 10737418240 bytes 
255 heads, 63 sectors/track, 1305 cylinders 
Units = cylinders of 16065 * 512 = 8225280 bytes 
Device Boot Start End Blocks Id System 
/dev/sda1 * 1 13 104391 83 Linux 
/dev/sda2 14 78 522112+ 82 Linux swap / Solaris 
/dev/sda3 79 1305 9855877+ 83 Linux 
# Check the disk space usage of the file system

df -h

[root@host ~]# df -h 
Filesystem Size Used Avail Use% Mounted on 
/dev/sda3 9.2G 6.4G 2.3G 74% / 
/dev/sda1 99M 12M 82M 13% /boot 
tmpfs 187M 0 187M 0% /dev/shm 
/dev/hdc 4.1G 4.1G 0 100% /mnt 

Server Performance Analysis

#Check the I/O performance of the hard disk

[root@host /]# iostat -d -x -k 1 5

#iostat is included in the systat package. In CentOs5.5, use the command yum -y install sysstat to install it.

I/0

Check the average load of Linux servers

[root@host /]# uptime 
12:39:12 up 2:50, 3 users, load average: 0.00, 0.03, 0.00 

[root@host /]# w 
12:39:59 up 2:50, 3 users, load average: 0.00, 0.03, 0.00 
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT 
root tty1 - 09:53 32:17 0.36s 0.36s -bash 
root pts/0 192.168.1.102 10:23 1:54m 0.03s 0.03s -bash 
root pts/1 192.168.1.105 12:16 0.00s 0.09s 0.02sw

Monitor the overall performance of your Linux server

Overall Performance

[root@host /]# vmstat 1 4 
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ 
rb swpd free buff cache si so bi bo in cs us sy id was 
0 0 0 50464 50096 101356 0 0 21 13 925 183 0 0 99 1 0 
0 0 0 50464 50096 101380 0 0 0 0 830 18 0 0 100 0 0 
0 0 0 50464 50096 101380 0 0 0 0 833 27 0 0 100 0 0 
0 0 0 50464 50104 101372 0 0 0 32 822 27 0 0 99 1 0

#proces r: Number of processes waiting to run b: Number of processes in non-interruptible sleep state w: Number of executable processes swapped out

#memory swpd: virtual memory usage fres: free memory buff: amount of memory used as cache (unit: KB)

#swap si: The number of swap pages swapped from disk to memory so: The number of swap pages swapped from memory to disk (unit: kb/second)

#io bi: number of blocks sent to the block device bo: number of blocks received from the block device (unit: blocks/second)

#system in: number of interrupts per second, including clock interrupts cs: number of environment (context) switches per second

#cpu us: CPU usage time sy: CPU system usage time id: idle time (unit: percentage)

Under standard conditions: r is less than 5, b is approximately 0

If user + sys is less than 70, the system performance is good; if it is greater than or equal to 85, the performance is poor.

View other parameters of the Linux server

Check the system kernel version number

[root@host /]# uname -a 
Linux host.domain.com 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux 
[root@host /]# uname -r 
2.6.18-194.el5

Check if the system is 32-bit or 64-bit

[root@host /]# ls -1F / |grep /$

Check if there is /lib64, if there is, the system is 64-bit

Another way to check whether the system is 32-bit or 64-bit

[root@host /]# file /sbin/init 
/sbin/init: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

View information about the Linux distribution used by the server

[root@host /]# lsb_release -a 
LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch 
Distributor ID: CentOS 
Description: CentOS release 5.5 (Final) 
Release: 5.5 
Codename: Final

View the relevant modules loaded by the system

[root@host /]# lsmod |grep ip 
ipv6 435361 24 
xfrm_nalgo 43333 1 ipv6 
dm_multipath 56920 0 
scsi_dh 42177 1 dm_multipath 
dm_mod 101649 4 dm_mirror,dm_multipath,dm_raid45,dm_log

Check PCI settings in Linux. The lspci command can list PCI information in the machine, such as sound card, graphics card, Modem

[root@host /]# lspci | grep Ether 
02:01.0 Ethernet controller: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)

Summarize

The above are the Linux server status and performance related commands introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • Detailed explanation of the performance monitoring ideas of specified processes in Linux system based on Python
  • A brief introduction to Linux performance monitoring commands free
  • PHP+swoole+linux to achieve system monitoring and performance optimization operation example
  • Detailed explanation of using top command to analyze Linux system performance
  • Detailed explanation of Linux performance test pmap command
  • 20 Linux server performance optimization tips worth collecting
  • Tutorial on using http_load, a web performance stress testing tool, under Linux
  • Four ways to achieve web data synchronization under Linux (performance comparison)
  • Linux+Nginx+Php to build a high-performance WEB server
  • Linux performance monitoring tool nmon installation and usage tutorial analysis

<<:  js implements a simple countdown

>>:  mysql 5.7.17 winx64.zip installation and configuration method graphic tutorial

Recommend

How to use nginx as a load balancer for mysql

Note: The nginx version must be 1.9 or above. Whe...

Web front-end performance optimization

Web front-end optimization best practices: conten...

Detailed explanation of how to select all child elements using CSS

How to recursively select all child elements usin...

Example code for implementing complex table headers in html table

Use HTML to create complex tables. Complex tables...

Nginx configuration based on multiple domain names, ports, IP virtual hosts

1. Type introduction 1.1 Domain-based virtual hos...

How to connect to a remote docker server with a certificate

Table of contents 1. Use scripts to encrypt TLS f...

Solve the problem of insufficient docker disk space

After the server where Docker is located has been...

What to do after installing Ubuntu 20.04 (beginner's guide)

Ubuntu 20.04 has been released, bringing many new...

The implementation process of long pressing to identify QR code in WeChat applet

Preface We all know that the QR codes in official...

Why MySQL chooses Repeatable Read as the default isolation level

Table of contents Oracle Isolation Levels MySQL I...

Use scripts to package and upload Docker images with one click

The author has been working on a micro-frontend p...

Detailed tutorial on installing Tomcat9 windows service

1. Preparation 1.1 Download the tomcat compressed...

How to automatically backup mysql remotely under Linux

Preface: Basically, whether it is for our own use...

How to view the IP address of the Docker container

I always thought that Docker had no IP address. I...