6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Linux][systemd] systemdの起動時間のボトルネックを解析する (systemd-analyzeの使用方法)

Posted at

TL;DR

systemd-analyzeで起動時のボトルネックを解析する方法メモ

実行方法

VirtualBox上のUbuntu 16.04で検証しました。

systemd-analyze : kernelとuserspaceそれぞれの起動時間の表示

$ systemd-analyze
Startup finished in 4.604s (kernel) + 4min 19.644s (userspace) = 4min 24.249s

systemd-analyze blame : 時間がかかっている順にサービスの起動時間を表示

$ systemd-analyze blame | head
    4min 12.385s apt-daily.service
         15.536s docker.service
          7.015s ModemManager.service
          4.008s apparmor.service
          3.843s networking.service
          3.618s NetworkManager.service
          3.391s dev-sda1.device
          2.811s thermald.service
          2.743s vboxadd.service
          2.693s avahi-daemon.service

systemd-analyze critical-chain : 時間のかかっている呼び出しチェーンを表示

$ systemd-analyze critical-chain 
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.

graphical.target @29.149s
└─multi-user.target @29.149s
  └─docker.service @13.612s +15.536s
    └─network.target @13.602s
      └─NetworkManager.service @9.984s +3.618s
        └─dbus.service @7.349s
          └─basic.target @7.258s
            └─sockets.target @7.258s
              └─snapd.socket @7.170s +67ms
                └─sysinit.target @7.168s
                  └─apparmor.service @3.133s +4.008s
                    └─local-fs.target @3.132s
                      └─run-user-1000-gvfs.mount @54.632s
                        └─run-user-1000.mount @49.219s
                          └─local-fs-pre.target @3.132s
                            └─systemd-remount-fs.service @3.080s +37ms
                              └─system.slice @1.713s
                                └─-.slice @1.693s

systemd-analyze plot > plot.svg : 起動時間のチャートをプロット

$ systemd-analyze plot > plot.svg

無題.png

参考

起動が遅い原因は?そんな時はsystemd-analyzeでチェック | Simple blog @atani
ブートパフォーマンスの向上 - ArchWiki
Improving performance/Boot process - ArchWiki

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?