Last Updated on 1 week by Sachin G

In this post, I will share how to diagnose and optimize your Linux system’s boot performance using systemd-analyze. These commands explore essential commands like systemd-analyze timeblame, and critical-chain to identify bottlenecks, measure startup delays, and improve overall boot efficiency.

Now, in most of the latest Linux distributions, Systemd is the default init system and has lots of new features. Systemd is designed for boot-up performance.

Now, through the systemd tool system-analyse, we can see the execution tree of systemd and analyse systemd status data. This will help in investigating of failure and the boot procedure is stuck on a unit, you would have the capacity to pinpoint the estimated area for your more profound examination.

Here I am showing four basic interesting commands to look at boot performance. This utility will work on CentOS, RHEL, Fedora, Ubuntu.

  • Systemd-analyze
  • systemd-analyze blame
  • systemd-analyze critical-chain
  • systemd-analyze plot
# systemd-analyze

OUTPUT :

Startup finished in 1.189s (kernel) + 2.012s (initrd) + 10.425s (userspace) = 13.626s

systemd-analyze, which will show timing insights about the boot procedures. To check the amount of time spent in user  and kernel space on boot, run cthe ommand below:

systemd-analyze blame

This will show a list of all running units, requested when they were introduced. This data may be utilized to streamline boot-up times. This output may be misdirecting as the startup of one service load is slow because it waits for the other service to complete initialization.

# systemd-analyze blame

systemd-analyze critical-chain 

To analyse in which units critical points in the start-up run the command below, for example. The time after the unit is active or started is printed after the “@” character. The time the unit takes to start is printed after the “+” character.

multi-user.target @10.406s
└─mariadb.service @5.187s +5.215s
└─network.target @4.885s
└─network.service @1.763s +3.108s
└─basic.target @1.748s
└─paths.target @1.738s
└─brandbot.path @1.738s
└─sysinit.target @1.670s
└─systemd-update-utmp.service @1.615s +52ms
└─auditd.service @1.458s +137ms
└─systemd-tmpfiles-setup.service @1.414s +36ms
└─rhel-import-state.service @1.340s +68ms
└─local-fs.target @1.332s
└─local-fs-pre.target @1.329s
└─systemd-tmpfiles-setup-dev.service @1.034s +287ms
└─kmod-static-nodes.service @900ms +127ms
└─systemd-journald.socket
└─-.mount
└─system.slice
└─-.slice

systemd-analyze plot :

For graphical representation we can create a svg plot graph which will  indicate graphical units.

#systemd-analyze plot > techtransit.svg

Image of SVG ploted graph