From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.atof.net (smtp1.atof.net [52.86.233.228]) by sourceware.org (Postfix) with ESMTPS id 2B1DD3858C66 for ; Wed, 10 May 2023 08:59:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B1DD3858C66 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gluelogic.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gluelogic.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Spam-Language: en X-Spam-Relay-Country: X-Spam-DCC: B=; R=smtp1.atof.net 1102; Body=1 Fuz1=1 Fuz2=1 X-Spam-RBL: X-Spam-PYZOR: Reported 0 times. Date: Wed, 10 May 2023 04:59:24 -0400 From: gs-cygwin.com@gluelogic.com To: cygwin@cygwin.com Cc: Bruno Haible Subject: Re: posix_spawn facility Message-ID: References: <1752276.7aRn1RRit1@nimes> <5022555.upeRZZJTqa@nimes> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 List-Id: On Thu, Apr 20, 2023 at 03:14:59AM -0400, gs-cygwin.com@gluelogic.com wrote: > On Mon, Apr 17, 2023 at 08:44:51PM +0200, Bruno Haible via Cygwin wrote: > > Btw, there are two more functions in the posix_spawn family meanwhile: > > * posix_spawn_file_actions_addchdir_np > > implemented by glibc [1], musl libc, macOS, FreeBSD [2], Solaris ≥ 11.3 > > used by a few packages (Firefox, Chromium, Rust) > > * posix_spawn_file_actions_addfchdir_np > > implemented in glibc, musl libc > > but not used by any package so far [3]. > > > > The next POSIX will contain these functions (without the _np suffix).[4] > > > > Bruno > > > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=17405 > > [2] https://man.freebsd.org/cgi/man.cgi?query=posix_spawn_file_actions_adddup2&apropos=0&sektion=3&manpath=FreeBSD+11-current&format=html > > [3] https://codesearch.debian.net/ > > [4] https://www.austingroupbugs.net/view.php?id=1208 > > With regards to [3] above, the next lighttpd release (lighttpd 1.4.70) > will use posix_spawn_file_actions_addfchdir_np(), where available, for > spawning CGI programs. > > I have not yet tested under cygwin, but under Linux the overhead of > initial CGI process creation can be greatly reduced by using > posix_spawn() instead of fork(),execve(). The speedup is inversely > proportional to how much work the target script performs (compared to > the overhead of initial process creation). On x86_64 Linux, running a > minimal C program for CGI can be ~60% faster in lighttpd when using > posix_spawn()! When running a minimal /bin/sh program for CGI, the > speedup is "only" ~20%! (Those numbers were obtained from running > h2load and weighttp microbenchmarks with the minimal CGI programs.) > > minimal C program for CGI (compiled gcc -O3): > #include > static const char resp[] = "Status: 200\n\n"; > int main(void) { write(STDOUT_FILENO, resp, sizeof(resp)-1); return 0; } > > minimal /bin/sh program for CGI: > #!/bin/sh > printf 'Status: 200\n\n' > > Cheers, Glenn lighttpd 1.4.70 has been released for cygwin and uses posix_spawn() when running CGI programs. Under cygwin 3.4.0, posix_spawn_file_actions_addfchdir_np() is not detected and so not used, but once cygwin 3.5.0 is out, I'll rebuild the lighttpd package on cygwin to take advantage of it. Cheers, Glenn