<div>Thanks for the reply!</div><div><br></div>On Mon, May 9, 2011 at 11:04 AM, Lennart Poettering <span dir="ltr">&lt;<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>&gt;</span> wrote:<br><div class="gmail_quote">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Mon, 09.05.11 09:10, Scott James Remnant (<a href="mailto:scott@netsplit.com">scott@netsplit.com</a>) wrote:<br>

<br>
&gt; This seems to assume that it&#39;s a free cost to start a service or process and<br>
&gt; have it block on a socket. But that isn&#39;t true, to get to the point where it<br>
&gt; connects to the socket, that service or process first has to be loaded from<br>
&gt; disk, its shared libraries mapped and relocated, it probably has to do a<br>
&gt; bunch of initialization including reading its own configuration files,<br>
&gt; etc.<br>
&gt;<br>
&gt; That&#39;s fine for &quot;low priority&quot; services out of the critical path for user<br>
&gt; interaction, but not for services we need as fast as possible.<br>
<br>
</div>We can now boot a resonably complete GNOME userspace in less than<br>
1s. Given that that is the *total* these days, I really don&#39;t<br>
understand why you are concerned about the startup speed of individual<br>
service, and fear timeouts there.<br>
<div class="im"><br></div></blockquote><div>Because that&#39;s on a machine with plenty of L1/L2 Cache, take that away and this becomes a big concern. Especially if 1s is a target boot time ;-)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
&gt; The best example I can think is the X server itself. It&#39;s pretty much the<br>
&gt; definition of the critical path. Everything started before the X server are<br>
&gt; those basic system components needed to start the X server, I understand in<br>
&gt; systemd that this core part would be a different target to the X part and a<br>
&gt; dep of it. Everything started after the X server is up are components of the<br>
&gt; user&#39;s session that aren&#39;t totally critical for them to login or use their<br>
&gt; computer.<br>
<br>
</div>X itself is really fast these days. While there&#39;s room for improvement<br>
it&#39;s far from the biggest speed bump right now. (LVM is)<br>
<div class="im"><br></div></blockquote><div>LVM isn&#39;t on our system. X is the biggest bump along with Chromium.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">
&gt; Firstly we have to spawn the X server, load the executable, map and relocate<br>
&gt; shared libraries, all of that jazz. You don&#39;t want anything else happening<br>
&gt; on the system alongside this, and you most certainly don&#39;t want every X<br>
&gt; client (Chromium/Firefox!) being loaded at the same time. The default<br>
&gt; behaviour of systemd seems to be to do just this :-(<br>
<br>
</div>Well, there&#39;s more than 30 years research in modern CPU and IO scheduler<br>
technology for the kernel. Instead of second guessing those from<br>
userspace I&#39;d just entrust them that they pick something like the<br>
optimal order. And if they don&#39;t, then go and optimize them for the new<br>
workloads, don&#39;t bypass them by scheduling things in userspace.<br>
<br></blockquote><div>I&#39;m glad you answered this way, because my thinking was in this direction too. The scheduler isn&#39;t that great in Linux at times, as we all know, because it lacks information about what&#39;s important. Since the kernel is able to schedule efficiently by cgroup, the ideal seems to be to start everything at once *but with different priorities* so that the services come up in something approaching a sane order.</div>
<div><br></div><div>We did something like this back in Ubuntu, all fsck processes are started simultaneously and we used I/O priorities to ensure only one was running at a time for any given physical disk. This worked awesomely well.</div>
<div><br></div><div>Obviously this &quot;startup priority&quot; isn&#39;t the same as the eventual priority you&#39;d want the service to settle at, you&#39;d want it to be pretty flexible - perhaps even changing a few times.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">&gt; Lastly there&#39;s the processes you&#39;d start after X is up and services are</div>
<div class="im">
&gt; connecting to it; again I assume this would be a different target - how<br>
&gt; would systemd know that X, and the critical X services/processes are fully<br>
&gt; up and that it can begin starting these. The important thing here is user<br>
&gt; latency - the startup of these services need to not noticeably impact system<br>
&gt; performance - not as simple as prioritization because the service itself may<br>
&gt; well need a different priority once its up. Any thoughts here?<br>
<br>
</div>Ignoring that X currently is not socket activatable I see no issue here<br>
at all.<br>
<br></blockquote><div>Really, this came as a surprise to me - don&#39;t all clients initially connect to X via its socket?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Also, note that launchd on MacOS does the same thing (including spawning<br>
X like this for X clients). They build their whole OS like this. And it<br>
works really really really well there. All experience with launchd and<br>
systemd tells the same story: socket activation is awesome. Plain awesome.<br>
<br></blockquote><div>You&#39;ve never had to reboot an iPhone, have you?</div><div><br></div><div>You need other entertainment while it does so, a copy of the Lord of the Rings sometimes suffices.</div><div><br></div><div>
Scott</div></div>