Optimizing RCng execution speed ?

Tim Kientzle tim at kientzle.com
Mon Apr 12 16:16:31 PDT 2004

Poul-Henning Kamp wrote:
> Is anybody working on optimizing RCng execution speed ?
> I think our boottime is getting a bit too slow these days...

I haven't tested the performance impact, but I've long
been suspicious of the way that RCng executes every
script in /etc/rc.d even if the corresponding functionality
is disabled.

For example, even if you've disabled all Kerberos
functionality, /etc/rc.d/kadmind will still get loaded
and executed just so it can test the kadmind5_server_enable
variable and abort immediately.

If rcorder could prune out such obviously-disabled scripts,
then that might make a difference.  For example,
we might add a new keyline to scripts:
    ONLY_IF: kadmind5_server_enable
or enforce a naming convention (the "kadmind_enable"
variable controls whether the "kadmind" script gets
run).  In this way, rcorder could pull in /etc/rc.conf,
then scan and order the available scripts, omitting
any that were clearly disabled.

Obviously, some scripts require more complex
"enabled" checking, but simple logic in rcorder
should be able to prune out the majority of the
disabled scripts without actually running them.

Tim Kientzle

P.S. There was a discussion about a year ago
on one of the mailing lists about the best
way for a C program to obtain the settings
from rc.conf.  The best approach was to fork
a shell and have it parse rc.conf and (via a
simple helper program) spit out the resulting
environment to be read in by the program.

More information about the freebsd-current mailing list