1 |
On Tue, Dec 25, 2012 at 1:38 AM, G.Wolfe Woodbury <redwolfe@×××××.com> wrote: |
2 |
[ snip ] |
3 |
> From what has been happening with the systemd stuff, I do not see what |
4 |
> advantages it really offers over the SysV scheme and its successors like |
5 |
> OpenRC. Someone enlighten me please? |
6 |
|
7 |
I wrote the following some months ago; I think nothing much has |
8 |
changed since then (I added a couple of comments): |
9 |
|
10 |
Take this with a grain (or a kilo) of salt, since I'm obviously |
11 |
biased, but IMHO this are systemd advantages over OpenRC: |
12 |
|
13 |
* Really fast boot. OpenRC takes at least double the time that systemd |
14 |
does when booting, easily verifiable. In my laptop systemd is twice as |
15 |
fast as OpenRC; in my desktop is three times faster. (With a solid |
16 |
state hard drive, my laptop now boots even faster). |
17 |
|
18 |
* Really parallel service startup: OpenRC has never been reliable on |
19 |
parallel service startup; its documentation says it explicitly. Some |
20 |
will tell you that for them "it works", but just like the guys who |
21 |
have a separate /usr and refuse to use an initramfs, they just haven't |
22 |
been bitten by the inherent problems of it (just ask kernel developer |
23 |
Greg Kroah-Hartman). The Gentoo devs recognize that OpenRC is just |
24 |
broken with parallel service startup. |
25 |
|
26 |
* Really simple service unit files: The service unit files are really |
27 |
small, really simple, really easy to understand/modify. Compare the 9 |
28 |
lines of sshd.service: |
29 |
|
30 |
$ cat /etc/systemd/system/sshd.service |
31 |
[Unit] |
32 |
Description=SSH Secure Shell Service |
33 |
After=syslog.target |
34 |
|
35 |
[Service] |
36 |
ExecStart=/usr/sbin/sshd -D |
37 |
|
38 |
[Install] |
39 |
WantedBy=multi-user.target |
40 |
|
41 |
with the 84 of /etc/init.d/sshd (80 without comments). |
42 |
|
43 |
* Really good documentation: systemd has one of the best |
44 |
documentations I have ever seen in *any* project. Everything (except |
45 |
really new, experimental features) is documented, with manual pages |
46 |
explaining everything. And besides, there are blog posts by Lennart |
47 |
explaining in a more informal way how to do neat tricks with systemd. |
48 |
|
49 |
* Really good in-site customization: The service unit files are |
50 |
trivially overrided with custom ones for specific installations, |
51 |
without needing to touch the ones installed by systemd or a program. |
52 |
With OpenRC, if I modify a /etc/init.d file, chances are I need to |
53 |
check out my next installation so I can see how the new file differs |
54 |
from the old one, and adapt the changes to my customized version. |
55 |
|
56 |
* All the goodies from Control Groups: You can use kernel cgroups to |
57 |
monitor/control several properties of your daemons, out of the box, |
58 |
almost no admin effort involved. |
59 |
|
60 |
* It tries to unify Linux behaviour among distros (some can argue that |
61 |
this is a bad thing): Using systemd, the same |
62 |
configurations/techniques work the same in every distribution. No more |
63 |
need to learn /etc/conf.d, /etc/sysconfig, /etc/default hacks by |
64 |
different distros. |
65 |
|
66 |
* Finally, and what I think is the most fundamental difference between |
67 |
systemd and almost any other init system: The service unit files in |
68 |
systemd are *declarative*; you tell the daemon *what* to do, not *how* |
69 |
to do it. If the service files are shell scripts (like in |
70 |
OpenRC/SysV), everything can spiral out of control really easily. And |
71 |
it usually does (again, look at sshd; and that one is actully nicely |
72 |
written, there are all kind of monsters out there abusing the power |
73 |
that shell gives you). |
74 |
|
75 |
These are the ones off the top of my head; but what I like the most |
76 |
about systemd is that it just works, and that it makes a lot of sense |
77 |
(at least to me). |
78 |
|
79 |
Most of systemd features can be implemented in OpenRC, although the |
80 |
speed difference will never be eliminated if OpenRC keeps using shell |
81 |
files; however, Luca Barbato said that using reentrant busybox the |
82 |
speed difference is greatly reduced (I haven't confirmed this, since I |
83 |
haven't even installed OpenRC in months). |
84 |
|
85 |
Now, this set of (IMO) advantages of systemd over OpenRC pile up over |
86 |
the advantages of OpenRC over SysV: the most important one (I believe) |
87 |
is that OpenRC has dependencies, so a service starts only when another |
88 |
has already started. AFAIK, SysV has lacked this since always. |
89 |
|
90 |
I don't think I have ever heard anyone saying that we should keep |
91 |
using SysV; like a lot of Unix legacies, it should just die. OpenRC is |
92 |
much better, but it still uses a Turing-complete language (and a |
93 |
really slow one) to simply tell services when to start and when to |
94 |
stop, and it doesn't reliably keep track of what services are really |
95 |
still running (anyone who has ever used the "zap" command in OpenRC |
96 |
knows this). |
97 |
|
98 |
systemd of course has dependencies, a reliable tracking of service |
99 |
status (thanks in part to the use of cgroups), and its service files |
100 |
can't enter in an infinite loop. |
101 |
|
102 |
Hope it helps. |
103 |
|
104 |
Regards. |
105 |
-- |
106 |
Canek Peláez Valdés |
107 |
Posgrado en Ciencia e Ingeniería de la Computación |
108 |
Universidad Nacional Autónoma de México |