Does systemd really use that much more memory?

Forum rules
We believe in Hello and Thank You.
pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Does systemd really use that much more memory?

Unread post by pidsley » Sat Jan 09, 2016 12:19 am

A post by Archvortex about how much more memory Arch and systemd used gave me an idea for an experiment. I have a 32-bit Jessie netinstall with both sysv and systemd on it, so I booted into the same system with each init and compared memory use.

console, sysv:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:       2061024      81812    1979212        404      12696      36500
-/+ buffers/cache:      32616    2028408
Swap:      1048572          0    1048572
console, systemd:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:       2061024     102556    1958468      10892      14756      51144
-/+ buffers/cache:      36656    2024368
Swap:      1048572          0    1048572
in X, evilwm, one terminal, sysv:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:       2061024     128832    1932192       8668      14596      72828
-/+ buffers/cache:      41408    2019616
Swap:      1048572          0    1048572
in X, evilwm, one terminal, systemd:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:       2061024     148176    1912848      19152      16124      86952
-/+ buffers/cache:      45100    2015924
Swap:      1048572          0    1048572
in X, evilwm, two terminals, iceweasel with six tabs, sysv:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:       2061024     493520    1567504      60088      17196     214020
-/+ buffers/cache:     262304    1798720
Swap:      1048572          0    1048572
in X, evilwm, two terminals, iceweasel with six tabs, systemd:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:       2061024     672084    1388940      66204      24116     374084
-/+ buffers/cache:     273884    1787140
Swap:      1048572          0    1048572
So... at least with this install, on this machine, systemd does use more memory, but the difference (in my opinion) is small, and should not be a deciding factor when you choose an init. Comparing Arch with systemd to Debian with sysv may be interesting, but proves nothing.

Note also that this says nothing about my init system preference (because I don't have a preference) and I'm not trying to convince people to use one init or another (because I don't care what init you use.)

User avatar
vic
Godot
Posts: 2118
Joined: Wed Oct 17, 2012 10:11 am
Location: /bin

Re: Does systemd really use that much more memory?

Unread post by vic » Sat Jan 09, 2016 12:35 am

Thanks pidsley. :)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Sat Jan 09, 2016 3:28 am

Thanks for the comparison.

I think it has also to do with how you set up systemctl (or rcconf for that matter) on the installs to be compared. Sure, the difference is somewhere around 10% more or less, but can be much bigger if you load all available services on one init system and disable them on the other.

If the argument is only "systemd uses more RAM after a cold boot", this might be right in most cases. I noticed an extremely high base RAM usage even without X on a Fedora install (around 100MB), followed by Arch and Ubuntu. What does matter a bit more is how available space is managed - so how quickly available space is offered to processes, how much is being swapped, how much additional swap space is available, and if the swap is on a physical drive or the actual RAM. The difference in responsiveness is evident if you are using anything <512MB RAM, in certain scenarios (GUI browser, active elements) even 1GB of RAM can be enough to make the system feel laggy.

Whenever we talk of systemd we should also mention the role of cgroups and the possibility of giving a kind of RAM consumption niceness (or swappiness) to certain processes: https://www.kernel.org/doc/Documentatio ... memory.txt

(writing this from a OpenRC-booted system) ;)
..gnutella..

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: Does systemd really use that much more memory?

Unread post by pidsley » Sat Jan 09, 2016 3:39 am

^ yes; part of why some systems appear to use more memory might be that they cache more things so they are available more quickly. This is not a bad thing if you have the memory for it.

I guess what I was trying to say is that claiming systemd is bad because it uses more memory doesn't look at the whole picture, and may not even always be accurate.

Writing this from a sysv-booted oldstable system, while upgrading a busybox-booted CRUX system on another machine, and a systemd-booted Debian system on another. ;)

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Sat Jan 09, 2016 4:23 am

^ absolutely understood what you were trying to say (as I agree fully) -- and we also forgot to consider other factors like for example the kernel in use.
..gnutella..

User avatar
Snap
Sperminator
Posts: 189
Joined: Sun Oct 05, 2014 8:11 pm

Re: Does systemd really use that much more memory?

Unread post by Snap » Sat Jan 09, 2016 9:29 am

Graet insights, folks. Thanks.

User avatar
GekkoP
Emacs Sancho Panza
Posts: 5878
Joined: Tue Sep 03, 2013 7:05 am

Re: Does systemd really use that much more memory?

Unread post by GekkoP » Sat Jan 09, 2016 9:40 am

Thanks for the comparison, really interesting to see the actual differences.

User avatar
dkeg
Configurator
Posts: 3782
Joined: Sun Nov 18, 2012 9:23 pm
Location: Mid-Atlantic Grill

Re: Does systemd really use that much more memory?

Unread post by dkeg » Sat Jan 09, 2016 11:55 am

Cool Pidsley, at something tells me you were not surpised at all with those results.

I thought we had done similar experiments in the past. Oh, maybe that was startup/shutdown. Either way, Its been a very long time since I used systemd, but I don't remember real memory issues. Memory differences seem to be more related to the kernel. Vanilla uses the least, closely followed by liquorix, and easily with the most mem usage is the towo kernels. That has been my experience at least.

Work hard; Complain less

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Sat Jan 09, 2016 1:25 pm

^ signed, towo kernels are a bit fatter, quite similar to slh kernels. The lightest one is vanilla 586, from what I have gathered so far.
..gnutella..

User avatar
rhowaldt
Dog
Posts: 4565
Joined: Wed Oct 17, 2012 9:01 am
Contact:

Re: Does systemd really use that much more memory?

Unread post by rhowaldt » Sat Jan 09, 2016 5:35 pm

thanks for this pidsley :)
All statements are true in some sense, false in some sense, meaningless in some sense, true and false in some sense, true and meaningless in some sense, false and meaningless in some sense, and true and false and meaningless in some sense.

User avatar
archvortex
Uninstaller
Posts: 241
Joined: Sat Sep 07, 2013 2:41 pm
Location: Vancouver, Canada

Re: Does systemd really use that much more memory?

Unread post by archvortex » Sun Jan 10, 2016 7:41 am

Thanks Pidsley for doing this. I think the point what I was trying to get across but not doing it very clearly was that given the choice between Arch with systemd and BBQ with sysvinit to install on an old system that I would choose BBQ because I found that it used less memory on my system. It wasn't really meant as a swipe at systemd. It was more about which release used less memory on my system. If Arch with systemd used less memory then it would make sense to choose it over Debian with sysvinit on my old system. I was comparing apples to oranges but not for performance reasons but in a general sense. If there was an Arch or Debian with some other init available and it used less memory then I would probably choose it. I want to try Haiku again and see how that fairs and maybe I'll skip Linux all together for BeOS. Lol!
GUIs??? We don't need no stinkin' GUIs!!!
LinuxBBQ - No bloated bullshit to meet the needs of the less technical Linux user
Color is bloat

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Sun Jan 10, 2016 11:10 am

^ In short: you won't :D
..gnutella..

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: Does systemd really use that much more memory?

Unread post by pidsley » Sun Jan 10, 2016 2:12 pm

^^ Not a problem archvortex. I have heard other people complain about Arch using more memory as if this is always a bad thing, so it pushed my buttons a little. And I really did wonder how much difference systemd made, so it was a useful experiment.

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: Does systemd really use that much more memory?

Unread post by franksinistra » Tue Jan 12, 2016 9:02 am

More intellectual nourishment from Pidsley. *Applause*

Regarding the kernels, liquorix is a bit bigger since it has a few more patches than the vanilla debian kernel. Not to mention the standard liquorix kernel config includes a few more debug and tracer options, which increases the amount of RAM and hdd space it needed. Tried disabling a few options once, but the resulting kernel still consumes a little bit more RAM than the 586, default crux, or de-blobbed kernel. As a workaround, in some of my more modern hardware, i usually add uksm patch http://kerneldedup.org/en/projects/uksm/download/ to the mix. The resulting kernel will consume less RAM, but the CPU usage will be a bit higher than the regular kernel.

Sorry for hijacking the topic, hope it helps.
rice no more.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Tue Jan 12, 2016 9:09 am

^ this post is approved by the committee.
..gnutella..

User avatar
ChefIronBelly
Approved BBQer
Posts: 1044
Joined: Mon Jan 13, 2014 6:01 am
Location: Michigan

Re: Does systemd really use that much more memory?

Unread post by ChefIronBelly » Tue Jan 26, 2016 12:53 pm

Thanks pidsley

posted from a stock net debian 8.3 install running systemd, X, evilwm.
(1/1) Installing: LinuxBBQ...................................[69%]==============[/]

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Tue Jan 26, 2016 7:37 pm

Thanks pidsley

(yesterday I installed Ubuntu on a spare partition [don't ask, just a test drive on another untested laptop], and I noticed the worst bottleneck was zeitgeist, avahi and all those services like bluetooth, cups, apport and whoopsie or whatever the shit is called. after removing these [plus unity, ibus, and actually the whole software package called ubuntu-desktop] I got a clean and lean, snappy system with still a lot of orphaned shit, but systemd doesn't really impact the speed and RAM usage as much as all the shit that had been installed in Ubuntu OOTB before)
..gnutella..

User avatar
ivanovnegro
Minister of Truth
Posts: 5449
Joined: Wed Oct 17, 2012 11:12 pm

Re: Does systemd really use that much more memory?

Unread post by ivanovnegro » Tue Jan 26, 2016 10:39 pm

Apport is such a piece of useless crap. Sorry for ranting. The GUI just complains and nothing more. But yes, installed Ubuntu some weeks ago and it was nice, really. But what Bacon said, it comes with those services and they eat a lot of your performance.

Now I just installed Debian Jessie with systemd on my better half's X200 and I cannot complain. It runs superb. Only thing, it killed Windows 7. :P Wow, we actually had Win 7 for three days on it because the machine came with it.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: Does systemd really use that much more memory?

Unread post by machinebacon » Wed Jan 27, 2016 4:33 am

^ killed on purpose or partitioning went kasperle? try a sudo update-grub, maybe it appears again :D
..gnutella..

User avatar
simgin
Meme Fodder
Posts: 1167
Joined: Sun Jan 06, 2013 12:07 am
Location: Bradford-on-Avon, UK

Re: Does systemd really use that much more memory?

Unread post by simgin » Wed Jan 27, 2016 11:34 am

^ Yeah from beyond the grave :D

Warning! Page break alert! :)
Someone told me that I am delusional, I almost fell off my unicorn.

Post Reply