From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] www: speed up global manifest.js.gz w/ "all" extindex
Date: Mon, 8 Apr 2024 09:49:21 +0000 [thread overview]
Message-ID: <20240408094921.800292-1-e@80x24.org> (raw)
By reducing internal event loop iterations, this brings 300+
inboxes down ~32ms to ~27ms. It should also be more consistent
on servers with busy event loops since all the Xapian DB traffic
happens at once, theoretically mproving cache utilization.
---
lib/PublicInbox/ConfigIter.pm | 7 +++----
lib/PublicInbox/ManifestJsGz.pm | 5 +++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/ConfigIter.pm b/lib/PublicInbox/ConfigIter.pm
index 14fcef83..f9e3451a 100644
--- a/lib/PublicInbox/ConfigIter.pm
+++ b/lib/PublicInbox/ConfigIter.pm
@@ -1,12 +1,11 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# Intended for PublicInbox::DS::event_loop in read-only daemons
# to avoid each_inbox() monopolizing the event loop when hundreds/thousands
# of inboxes are in play.
package PublicInbox::ConfigIter;
-use strict;
-use v5.10.1;
+use v5.12;
sub new {
my ($class, $pi_cfg, $cb, @args) = @_;
@@ -25,7 +24,7 @@ sub event_step {
PublicInbox::DS::requeue($self) if defined($section);
}
-# for generic PSGI servers
+# for generic PSGI servers, but also ManifestJsGz w/ ALL extindex
sub each_section {
my $self = shift;
my ($pi_cfg, $i, $cb, @arg) = @$self;
diff --git a/lib/PublicInbox/ManifestJsGz.pm b/lib/PublicInbox/ManifestJsGz.pm
index 1f739baa..be5d5f2a 100644
--- a/lib/PublicInbox/ManifestJsGz.pm
+++ b/lib/PublicInbox/ManifestJsGz.pm
@@ -82,8 +82,9 @@ sub response {
$ctx->can('list_match_i'), $re, $ctx);
sub {
$ctx->{-wcb} = $_[0]; # HTTP server callback
- $ctx->{env}->{'pi-httpd.async'} ?
- $iter->event_step : $iter->each_section;
+ ($ctx->{www}->{pi_cfg}->ALL ||
+ !$ctx->{env}->{'pi-httpd.async'}) ?
+ $iter->each_section : $iter->event_step;
}
}
reply other threads:[~2024-04-08 9:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240408094921.800292-1-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).