Analyzing the startup performance of Linux system with system d-analyze

Time:2021-10-25

SYSTEMd analyze is a tool for analyzing startup performance, which is used to analyze service time consumption at startup. The default display is the elapsed time of kernel and user space:
 

Copy code

The code is as follows:

[[email protected]~]#systemd-analyze
Startupfinishedin818ms(kernel)+6.240s(initrd)+32.979s(userspace)=40.038s

 

It has the same effect as using the SYSTEMd analyzetime command.

(1) View the detailed startup time consumed by each service

View the detailed startup time consumed by each service through the SYSTEMd analyzeblame command:
 

Copy code

The code is as follows:

[[email protected]~]#systemd-analyzeblame
30.852siscsi.service
16.994skdump.service
10.871sboot.mount

103mssystemd-sysctl.service
101msdatapool.mount

 

(2) View the time consuming services tree

The SYSTEMd analyzecritical chain command prints the service tree table that consumes a lot of time, and sorts it according to the start-up time. The more time it consumes, the higher it comes to the [email protected] After that is the time of service activation or startup, and after the + sign is the time consumed by service startup. Personal understanding @ is the time from system boot to service startup, which is a relative time consumption, + is the time consumed by service startup, which is an absolute time consumption.
 

Copy code

The code is as follows:

[[email protected]~]#systemd-analyzecritical-chain
Thetimeaftertheunitisactiveorstartedisprintedafterthe”@”character.
Thetimetheunittakestostartisprintedafterthe”+”character.
[email protected]
└─[email protected]+16.994s
└─[email protected]
└─[email protected]+54ms
└─[email protected]+535ms
└─[email protected]
└─[email protected]
└─[email protected]
└─[email protected]
└─[email protected]+2ms
└─[email protected]+67ms
└─[email protected]
└─[email protected]+10.871s
└─[email protected]\x2duuid-8c77568b\x2d7e51\x2d4e32\x2dbbdf\[email protected]+226ms
└─[email protected]+152ms
└─[email protected]+25ms

 

(3) Print analysis chart and other commands

SYSTEMd analyzeplot prints a service consumption schedule in SVG format, which can be displayed graphically through the browser, which is very intuitive:

Copy code

The code is as follows:

[[email protected]~]#systemd-analyzeplot>plot.svg

 
201571151631599.jpg (871×614)

Other parameters:
SYSTEMd analyzedot generates the current service with a separator
SYSTEMd analyzedump displays the current service status in a friendly manner
6systemd file type and storage location
The SYSTEMd configuration file is called a unit unit and ends with a different extension depending on the type.
. service system service;
. target a set of system services;
. automount auto mount point;
. device the device that can be recognized by the kernel;
. mount mount point;
. path file system file or directory;
A process created outside of. Scope;
. slice is a system process managed by component hierarchy;
. snapshot system service status management;
. socket interprocess communication socket;
. swap defines a swap file or device;
. timer defines a timer.

Recommended Today

OC basis

IOS development interview essential skills chart.png What are objects and what are the objects in OC? An object is an instance of a class; Is an instance created through a class, which is generally called an instance object; Common objects in OC include instance objects, class objects, and metaclass objects; What is a class? What […]