LWN.net Logo

Runit makes a speedy replacement for init (Linux.com)

Mark Alexander Bain looks at Runit on Linux.com "runit, a Unix init scheme with service supervision written by Gerrit Pape, is a complete replacement for SysVinit. Its key benefits include improved boot speed and ease of use. In the time that it takes you to read this article, you could move from init to runit. In a recent article covering the use of cinit to implement a parallel boot process, I managed to turn a booting time of 2 minutes 54 seconds into 2 minutes 3 seconds -- a massive saving of 51 seconds. By converting the same Linux machine to runit, I was able to reduce booting time to 55 seconds."
(Log in to post comments)

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 8:40 UTC (Fri) by Duncan (guest, #6647) [Link]

The big benefit seems to be a dependency based parallel startup, as
opposed to the old standard numeric based serial startup. However, modern
systems, even those using init, should be doing parallel startup already.
I know Gentoo's recently released baselayout 1.12.0 does, altho I've been
running the -pre and -rc versions for some time, getting the benefits of
dependency based parallel startup. It's still runlevel init-based, but
rather different from the standard numeric services order, due to use of
rather different rc scripts, dependency based rather than numeric. Gentoo
has had the dependency based scripts for some time (years), but only
recently, with baselayout 1.12.0, have they actually taken that to full
parallel boot.

The two remaining bottlenecks are the hardware/BIOS POST, and the
boot-time fs journal and integrity checks. The latter could be bypassed
to some extent in theory, relying only on the mount-time journal replay,
but there's a potential cost to filesystem stability over time. For that
reason, I've chosen to continue doing the integrity checks.

Anyway, I don't see much benefit in trying runit here, tho if folks are
still running serial sequenced inits (do RH/Mandr*/SuSE still run serial
sequenced? the article implies Debian does by default, but this is a
ready-made change-over them), it could certainly make a significant
difference.

Duncan

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 11:28 UTC (Fri) by NAR (subscriber, #1313) [Link]

The two remaining bottlenecks are

In my experience the starting of exim is the slowest thing in the startup - especially if there's no network and I have to wait minutes for the timeout...

Bye,NAR

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 11:51 UTC (Fri) by bk (guest, #25617) [Link]

Gentoo's dependency-based init system is nice. If the network startup failed for some reason all network-dependent services will be skipped.

It also supports parallel service startup but for whatever reason that doesn't speed up the boot process significantly.

Runit makes a speedy replacement for init (Linux.com)

Posted May 28, 2006 11:01 UTC (Sun) by NAR (subscriber, #1313) [Link]

Actually the network setup succeeds, the problem is between the router and the ADSL provider, so the DNS server is not reachable.

Bye,NAR

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 11:34 UTC (Fri) by k8to (subscriber, #15413) [Link]

Runit may not bring speed benefits over other parallel approaches, but it
does bring vastly overcomplicated configuration, the need to read a much
larger number of files to determine problems, inferior documentation, and
general unpleasantness.

Avoid.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 11:58 UTC (Fri) by kirkengaard (subscriber, #15022) [Link]

yeah, I especially love djb's package/ hierarchy as dictated by the install page. Mmmm ... general unpleasantness and FHS flaming ...

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 17:39 UTC (Fri) by charlieb (subscriber, #23340) [Link]

Use of /package is not mandatory. runit can easily be built to install in an FHS compliant way.

Get over it.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 23:17 UTC (Fri) by kirkengaard (subscriber, #15022) [Link]

"Dude, harsh." You needed the last poke?

I'm over it, and I had figured that out. I have no complaints about the software. It has good ideas. It works. This makes the install page no less pushy; I like software that lets me do the administration. Still, djb's idea carries a kernel of good thought, implemented in FHS-antagonistic fashion. That's what /usr/local is for. But configure your system how it works for you.

And calm down some.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 17:43 UTC (Fri) by charlieb (subscriber, #23340) [Link]

"vastly overcomplicated configuration"? One directory containing a subdirectory for each service to be run, each of those containing at minimum *one* file - a "run" script.

"Avoid." That's your advice. My advice is "Try it".

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 13:58 UTC (Fri) by vondo (guest, #256) [Link]

Mandriva, as of the 2006 version, still does sequential as far as I can tell. They began starting X earlier in the process a couple of versions ago which appears to bring things up a little faster.

I'm contemplating a move to Ubuntu this summer. Does that boot faster?

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 15:31 UTC (Fri) by maxmtl2002 (guest, #3990) [Link]

From my small experience on Ubuntu, it does not boot fast out of the box.

You have to disable a lot of services that you do not use. Search the ubuntu forums for more informations.

For example, it start LVM, evms and other services by default, which are not necessarily used.

Runit makes a speedy replacement for init (Linux.com)

Posted May 27, 2006 11:40 UTC (Sat) by niner (guest, #26151) [Link]

SuSE has been doing parallel starts for years now. Dependencies are given by the init scripts and start numbers are calculated based on these dependencies. Scripts with equal dependencies get equal numbers and equal numbers are started in parallel.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 14:20 UTC (Fri) by jreiser (subscriber, #11027) [Link]

Initializing ntp (to synchronize the local clock with network time) has been known to take 10 or 20 seconds. Most single-user systems probably can avoid ntp entirely, but if you have "he said, she said" arguments with other machines (intrusion attempts, spam fighting, etc.) then an accurate clock helps make the sytsem log useful.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 14:29 UTC (Fri) by hazelsct (subscriber, #3659) [Link]

Why wait for that at boot time? Isn't that really better done in (ana)cron, when it either happens five or so minutes after boot, or if the machine is left on for days then at a regular frequency to prevent drift? Either way, it's done unobtrusively in the background.

how

Posted May 26, 2006 14:56 UTC (Fri) by ccyoung (subscriber, #16340) [Link]

SFMGI (Sorry For My Glaring Ingorance) but how do you cron a job to run five minutes after boot?

how

Posted May 26, 2006 15:15 UTC (Fri) by gowen (guest, #23914) [Link]

Cron, I dont know, but you can do it by running at at boot time.

Or you can always use the age old trick of putting
sleep 300
at the beginning of NTP's startup file.

how

Posted May 26, 2006 15:28 UTC (Fri) by tjw.org (subscriber, #20716) [Link]

http://jeremy.zawodny.com/blog/archives/001021.html

@reboot sleep 300 && my_command

Of course this is only for Vixie cron, I don't think any others support it. It's really only useful for users who can't edit init scripts. System wide settings made by root should be done in the regular init configuration.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 19:23 UTC (Fri) by mattdm (subscriber, #18) [Link]

Instead of calling something from cron, just run ntpd, which will slew the clock to run very close to exactly precise. However, this approach isn't very good when the clock is way off -- therefore, it's nice to check and jump to the right time at system startup if needed.

Runit makes a speedy replacement for init (Linux.com)

Posted May 29, 2006 12:03 UTC (Mon) by renox (guest, #23785) [Link]

Well I suppose that it depends if the ntp script does a quick time adjustement at startup or not (rdate like)..
If the ntp script does the quick time update then either it must be split in two or it must be done before the other applications: many application don't like to have the system time updated quickly when they are running, especially when the system time goes back in the past..

Runit makes a speedy replacement for init (Linux.com)

Posted Jun 12, 2006 10:03 UTC (Mon) by job (subscriber, #670) [Link]

There is something seriously wrong if ntpd takes a long time to start, it
is a daemon that normally forks away in the background and that should
take in the order of milliseconds. It is also not something you run on an
interval, you are thinking of ntptime.

Runit makes a speedy replacement for init (Linux.com)

Posted May 26, 2006 23:05 UTC (Fri) by NCunningham (subscriber, #6457) [Link]

Of course you can get much shorter boot times by not booting at all :) I started working on Suspend to disk precisely because it is much faster. When I first started, I was waiting for Linux to boot, then starting Win4Lin, then starting my Bible study software. 5 minutes have passed and I haven't done anything useful. Hardware has gotten a lot faster in the time, but the point still remains. The best solution to slow boots is to not boot at all.

Yes, drivers are still getting there, but there are workarounds for most issues, and they'll come up to speed over time. Rather than complaining and not using suspend to disk, bug the driver authors and get the support improved.

Booting is for installing a new kernel. Suspending should be the norm.

Regards,

Nigel

InitNG and Bootchart

Posted May 27, 2006 10:11 UTC (Sat) by pbts (guest, #38021) [Link]

This is not the only sysvinit replacement. There is one other major one, to my knowledge: InitNG.

Also, to compare the speed by using a wall clock is not very accurate; those interested in the real, proven-speediest solution should use Bootchart to determine the facts.

InitNG and Bootchart

Posted Jun 1, 2006 17:20 UTC (Thu) by cventers (subscriber, #31465) [Link]

While I'll grant that there's more to it than wall clock, if you are
comparing InitNG to runit and each is configured to start the same
system, wall clock _is_ the most accurate measure. Because wall clock is
how long the user had to wait for their system to be ready.

If they had to turn a hand-crank to supply power to the processor for all
cycles used, there might be other interesting numbers (to the end-user)
as well.

Bootchart is a tool useful for developers, because it allows us to see
where that wall time is going. But for users, wall clock is the one and
true measure.

Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.