From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8F4AD1F723 for ; Fri, 27 Oct 2023 22:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698445277; bh=9dPT+u1PBBUvs7IylVE7I3PftsPHB170ievvnIgY1XA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=um8b0Hh1xPiPnN3HVFUxbp9DiqAHRPwQjYbLsxvTRkT8IaUVyLZqJOcfHZpihAmH/ v0aubk0h12upcb1Yl68lO028F1L/X97WEnpawqxvG33XCA94rW0SC0eTxSnzDV+NmO eKiGULxqEpqbX1gSFjoQbx49oSZ6OaWk+wT0z7i0= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 08/10] www_altid: reduce FD pressure in qspawn queues Date: Fri, 27 Oct 2023 22:21:14 +0000 Message-ID: <20231027222116.4034363-9-e@80x24.org> In-Reply-To: <20231027222116.4034363-1-e@80x24.org> References: <20231027222116.4034363-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We can use the built-in stdin redirection functionality of spawn() instead of creating a pipe that sits idle in the queue on busy servers. --- lib/PublicInbox/WwwAltId.pm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/WwwAltId.pm b/lib/PublicInbox/WwwAltId.pm index 48520142..31d9b607 100644 --- a/lib/PublicInbox/WwwAltId.pm +++ b/lib/PublicInbox/WwwAltId.pm @@ -61,14 +61,9 @@ The administrator needs to install the sqlite3(1) binary to support gzipped sqlite3 dumps. EOF - # setup stdin, POSIX requires writes <= 512 bytes to succeed so - # we can close the pipe right away. - pipe(my ($r, $w)) or die "pipe: $!"; - syswrite($w, ".dump\n") == 6 or die "write: $!"; - close($w) or die "close: $!"; - # TODO: use -readonly if available with newer sqlite3(1) - my $qsp = PublicInbox::Qspawn->new([$sqlite3, $fn], undef, { 0 => $r }); + my $qsp = PublicInbox::Qspawn->new([$sqlite3, $fn], undef, + { 0 => \".dump\n" }); $ctx->{altid_pfx} = $altid_pfx; $env->{'qspawn.filter'} = PublicInbox::GzipFilter->new; $qsp->psgi_yield($env, undef, \&check_output, $ctx);