Do you use let's encrypt?





4082 votes ~ 17 comments

 

Analysing performance problems with systemd

Posted by Steve on Sat 26 Sep 2015 at 18:06

Tags:

Now that Systemd is the default init-system in fresh installations of Debian GNU/Linux it is worth highlighting some of the new features.

One thing that Systemd is designed to do is speed up the booting of systems. True most installations are "servers" and as-such they're rarely rebooted, but I've been living with and working with a Debian laptop and Debian desktop for the past few years - and the laptop gets shutdown every day, and for that reason it is interesting to see how long a boot takes, and where that time is taken.

Three interesting commands to look at the boot-speed of a system are:

  • systemd-analyze
  • systemd-analyze critical-chain
  • systemd-analyze blame

This allow you to see the times that are taken to start various things. For example the second command on this laptop shows me:

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 @5.384s
└─multi-user.target @5.384s
  └─NetworkManager.service @5.105s +278ms
    └─basic.target @5.103s
      └─paths.target @5.103s
        └─acpid.path @5.103s
          └─sysinit.target @5.102s
            └─console-setup.service @5.047s +54ms
              └─kbd.service @5.024s +23ms
                └─remote-fs.target @5.023s
                  └─local-fs.target @5.022s
                    └─lvm2-monitor.service @4.995s +24ms
                      └─system.slice @70ms
                        └─-.slice @68ms

Similarly if I run the "systemd-analyze blame" command I can see that the longest stall is waiting for:

          4.548s systemd-cryptsetup@home.service

Most of this stall is waiting for me to enter the passphrase for my encrypted /home directory!

Feel free to share other notes and comments about systemd below!

 

 


Re: Analysing performance problems with systemd
Posted by Anonymous (75.134.xx.xx) on Mon 28 Sep 2015 at 16:59
Where are these systemd commands such as 'systemd-analyze' documented? Are there other systemd commands like this that one can explore? None of this seems to be clearly documented, I only hear about these switches such as '-analyze' from places such as the Arch Wiki or a post like this one. Where is the official sytemd documentation? I would love to have a copy of my own. Something nice and in-depth and comprehensive.

What others functions are there to explore besides the '-analyze' function?

[ Parent | Reply to this comment ]

Re: Analysing performance problems with systemd
Posted by Steve (159.253.xx.xx) on Mon 28 Sep 2015 at 17:03
[ View Steve's Scratchpad | View Weblogs ]

Pretty much every binary installed with systemd has a man-page, which means that you should have the documentation locally. However I agree that things could be improved with a decent top-level overview.

I found the "The systemd for Administrators Blog Series" enormously helpful in giving a good flavour of options and capabilities; you can find that here on the official website:

--
Steve

[ Parent | Reply to this comment ]

Re: Analysing performance problems with systemd
Posted by Anonymous (192.168.xx.xx) on Thu 10 Dec 2015 at 10:21
Fine **IF** using a LAPTOP

But extending all systemd with this single boot fast view is nonsense

Servers don't really care how long - but how safe and secure
And that is NOT via systemd at all

Debian has gone the wrong way via systemd defaults.
Hope to revert this

2 cents

[ Parent | Reply to this comment ]

Re: Analysing performance problems with systemd
Posted by Anonymous (174.4.xx.xx) on Mon 18 Apr 2016 at 19:07
I feel exactly the same, I do not want systemd. WTH happened debian your choice was made way to hasty.

[ Parent | Reply to this comment ]

Re: Analysing performance problems with systemd
Posted by Anonymous (88.2.xx.xx) on Mon 23 May 2016 at 03:56
With all respects to Debian team... i do not like Systemd and had moved back to SystemV my Jessie Servers... everything works ok so far!

[ Parent | Reply to this comment ]

Re: Analysing performance problems with systemd
Posted by maxk (46.117.xx.xx) on Mon 26 Sep 2016 at 11:21
[ View Weblogs ]
systemd is not only init system with convenient terminology to express dependencies in a sane fashion.
For me main input is: good mechanisms to isolate services into descrete "slices" (using cgroups, i.e. containers),
I believe yet another level of isolation is a good thing.
Another good thing is journald, which so happens to be is a nice systemd side effect (the moment you learn how to use it)
systemd-analyze can also show you boot log BEFORE "traditional" logging daemons started, which is also handy.


Well, I bid you farewell.

[ Parent | Reply to this comment ]