新聞中心
這篇文章主要講解了“Linux系統(tǒng)的啟動性能簡單分析”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Linux系統(tǒng)的啟動性能簡單分析”吧!
systemd-analyze是一個分析啟動性能的工具,用于分析啟動時服務(wù)時間消耗。默認(rèn)顯示啟動是內(nèi)核和用戶空間的消耗時間:
代碼如下:
[root@localhost~]#systemd-analyze
Startupfinishedin818ms(kernel)+6.240s(initrd)+32.979s(userspace)=40.038s
和使用systemd-analyzetime命令的效果一樣。
(1)查看詳細(xì)的每個服務(wù)消耗的啟動時間
通過systemd-analyzeblame命令查看詳細(xì)的每個服務(wù)消耗的啟動時間:
代碼如下:
[root@localhost~]#systemd-analyzeblame
30.852siscsi.service
16.994skdump.service
10.871sboot.mount
...
103mssystemd-sysctl.service
101msdatapool.mount
(2)查看嚴(yán)重消耗時間的服務(wù)樹狀表
systemd-analyzecritical-chain命令打印嚴(yán)重消耗時間的服務(wù)樹狀表,按照啟動消耗的時間進(jìn)行排序,時間消耗越多,越排到前面。@之后是服務(wù)激活或者啟動的時間,+號之后是服務(wù)啟動消耗的時間。個人理解@是從系統(tǒng)引導(dǎo)到服務(wù)啟動起來的時間,是一個相對時間消耗,+是服務(wù)啟動消耗的時間,是一個絕對時間消耗。
代碼如下:
[root@localhost~]#systemd-analyzecritical-chain
Thetimeaftertheunitisactiveorstartedisprintedafterthe"@"character.
Thetimetheunittakestostartisprintedafterthe"+"character.
multi-user.target@32.976s
└─kdump.service@15.981s+16.994s
└─network.target@15.980s
└─NetworkManager.service@15.069s+54ms
└─firewalld.service@14.532s+535ms
└─basic.target@14.532s
└─sockets.target@14.532s
└─dbus.socket@14.532s
└─sysinit.target@14.527s
└─systemd-update-utmp.service@14.524s+2ms
└─systemd-tmpfiles-setup.service@14.456s+67ms
└─local-fs.target@14.447s
└─boot.mount@3.575s+10.871s
└─systemd-fsck@dev-disk-by\x2duuid-8c77568b\x2d7e51\x2d4e32\x2dbbdf\x2ddc12ff737bbf.service@3.348s+226ms
└─systemd-fsck-root.service@1.237s+152ms
└─systemd-readahead-replay.service@1.073s+25ms
(3)打印分析圖及其他命令
systemd-analyzeplot打印一個svg格式的服務(wù)消耗時間表,通過瀏覽器可以以圖形的方式展示,非常直觀:
代碼如下:
[root@localhost~]#systemd-analyzeplot>plot.svg
其他參數(shù):
systemd-analyzedot用分隔符產(chǎn)生當(dāng)前服務(wù)
systemd-analyzedump以友好方式顯示當(dāng)前服務(wù)狀態(tài)
6systemd文件類型及存放位置
systemd配置文件被稱為unit單元,根據(jù)類型不同,以不同的擴展名結(jié)尾。
.service系統(tǒng)服務(wù);
.target一組系統(tǒng)服務(wù);
.automount自動掛載點;
.device能被內(nèi)核識別的設(shè)備;
.mount掛載點;
.path文件系統(tǒng)的文件或者目錄;
.scope外部創(chuàng)建的進(jìn)程;
.slice一組分層次管理的系統(tǒng)進(jìn)程;
.snapshot系統(tǒng)服務(wù)狀態(tài)管理;
.socket進(jìn)程間通訊套接字;
.swap定義swap文件或者設(shè)備;
.timer定義定時器。
感謝各位的閱讀,以上就是“Linux系統(tǒng)的啟動性能簡單分析”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Linux系統(tǒng)的啟動性能簡單分析這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司,,小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
網(wǎng)頁題目:Linux系統(tǒng)的啟動性能簡單分析-創(chuàng)新互聯(lián)
鏈接分享:http://www.ef60e0e.cn/article/goidc.html