https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412020-11-28T00:35:23Zlighty labsLighttpd - Feature #3042: lighttpd on demandhttps://redmine.lighttpd.net/issues/3042?journal_id=120932020-11-28T00:35:23Zgstrauss
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Need Feedback</i></li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>Low</i></li></ul><p>As with any feature request about performance, where are your performance numbers and explanation behind the requested performance parameters?</p>
<p>lighttpd is very fast can typically serve simple requests < 100 us for new connections and < 10 us on keep-alive connections. By comparison, lighttpd startup can be slower, some 10-20 ms, though possibly longer for more involved configurations starting up fastcgi backends. Still, serving an initial request in < 20 ms falls within the realm of reasonable, and can (much) more quickly serve subsequent keep-alive requests on the same connection.</p>
<p>The above <strong>initial</strong> startup time for the first request is the same whether or not "wait" is "no" or if it is "yes". If that does not meet your requirements for the first request, then using lighttpd with xinetd is probably not an acceptable solution. Instead, lighttpd is low-resource (low CPU use and low memory) and can be left as a running daemon, which is after all the way lighttpd is primarily intended to be run. Additionally, if the fastcgi or other backends are expensive in memory use or startup time, lighttpd supports adaptive backend spawning using <code>"min-procs" => 0</code> since lighttpd 1.4.46. See <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Adaptive spawning with min-procs=>0 (Fixed)" href="https://redmine.lighttpd.net/issues/1162">#1162</a></p>
<p>Given the above, more justification is needed to demonstrate how the aforementioned options are insufficient <strong>and</strong> why the additional option you are proposing is better than the existing options. <strong>Details required.</strong> (Opinions will be discarded.)</p>
<p>Besides, you can already use lighttpd with xinetd "wait" = "yes" by having xinetd execute a shell script which dup()s stdin to fd 3, sets up systemd socket activation environment variables, and then execs lighttpd with <code>-i <timeout></code> and configured with <code>server.systemd-socket-activation = "enable"</code></p> Lighttpd - Feature #3042: lighttpd on demandhttps://redmine.lighttpd.net/issues/3042?journal_id=120942020-11-29T22:12:43Zgstrauss
<ul><li><strong>Status</strong> changed from <i>Need Feedback</i> to <i>Invalid</i></li><li><strong>Target version</strong> deleted (<del><i>1.4.x</i></del>)</li></ul><blockquote>
<p>This feature request is for lighttpd to expect a listen socket as fd 0 instead of a connected socket if both -1 AND -i <secs> have been given as options.</p>
</blockquote>
<p>No. You may not suggest breaking existing usage just because you want the combination to do something new.</p>
<blockquote>
<p>In other words, web server on demand with none of the performance limitations of `wait = no` nor the resource implications of having a process running and idle that's not being used (on a machine with limited resources).</p>
</blockquote>
<p>That statement is untrue. I fail to see how <code>wait = no</code> or <code>wait = yes</code> differ in any way for the <strong>initial</strong> request.</p>
<p>lighttpd is already available "on demand" via multiple options. To minimize memory usage, run a 32-bit lighttpd executable, do not load unneeded modules, and see <code>min-procs</code> in <a class="wiki-page" href="https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ConfigurationOptions#gw_backend-gateway-server-host-options">gateway server host options</a>. Also, if not using mod_indexfile or mod_dirlisting, <code>server.compat-module-load = "disable"</code> and <code>server.modules += ("mod_staticfile")</code> will avoid loading mod_indexfile and mod_dirlisting. <code>server.max-connections = 16</code> for small embedded systems reduces a memory usage a few more bytes, as long as that setting is appropriate for your small embedded system.</p>
<p>Try this:</p>
<p>lighttpd.conf<br /><code>server.systemd-socket-activation = "enable"</code></p>
<p>xinetd <code>wait = yes</code> script to start lighttpd<br /><pre>
#!/bin/sh
3<&0
export LISTEN_PID=$$
export LISTEN_FDS=1
exec /usr/sbin/lighttpd -i 3600 ...
</pre></p> Lighttpd - Feature #3042: lighttpd on demandhttps://redmine.lighttpd.net/issues/3042?journal_id=120952020-12-01T00:37:02Zgstrauss
<ul></ul><p>Correction: lighttpd -1 one-shot mode up to lighttpd 1.4.56 does not support keep-alives on the same connection.</p>
<p>keep-alive on one-shot connections will be permitted in lighttpd 1.4.57, as long as keep-alives are not disabled in lighttpd.conf.</p>