unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [FAIL?] cindex: maximize SMP when dumping inboxes for --associate
Date: Thu, 24 Aug 2023 22:14:14 +0000	[thread overview]
Message-ID: <20230824221414.M803225@dcvr> (raw)
In-Reply-To: <20230824220746.13248-1-e@80x24.org>

  Note: this appears to result in a slight performance regression,
  I think, but I'm on a busy system...

  In theory I expect it to work since smaller work units means
  better work distribution when we're dealing with a few gigantic
  inboxes (LKML) and many smaller ones; but perhaps the extra
  IPC overhead from the multitudes of small inboxes on my lore
  mirror ends up hurting.

Instead of dumping all Xapian shards of an inbox with a
single xap_helper command, issue one xap_helper command
per-shard (as we already do with the cidx shards) to get
smaller work units and improve work sharing.
---
 lib/PublicInbox/CodeSearchIdx.pm | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index a9a7d313..d6348740 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -551,14 +551,18 @@ sub dump_roots_start {
 sub dump_ibx { # sends to xap_helper.h
 	my ($self, $ibx_id) = @_;
 	my $ibx = $IBX[$ibx_id] // die "BUG: no IBX[$ibx_id]";
-	my @cmd = ('dump_ibx', $ibx->isrch->xh_args,
-			(map { ('-A', $_) } @ASSOC_PFX),
-			$ibx_id, $QRY_STR);
-	pipe(my ($r, $w)) or die "pipe: $!";
-	$XHC->mkreq([$DUMP_IBX_WPIPE, $w], @cmd);
+	my @args = map { ('-A', $_) } @ASSOC_PFX;
 	my $ekey = $ibx->eidx_key;
-	$self->{PENDING}->{$ekey} = $TODO{associate};
-	PublicInbox::CidxXapHelperAux->new($r, $self, $ekey);
+	my $es = $ibx->isrch->{es};
+	push(@args, '-O', $ekey) if defined $es;
+	push(@args, $ibx_id, $QRY_STR);
+	for my $d ($es ? $es->shard_dirs : $ibx->isrch->shard_dirs) {
+		pipe(my ($r, $w)) or die "pipe: $!";
+		$XHC->mkreq([$DUMP_IBX_WPIPE, $w], qw(dump_ibx -d), $d, @args);
+		my $desc = "$ekey -d $d";
+		$self->{PENDING}->{$desc} = $TODO{associate};
+		PublicInbox::CidxXapHelperAux->new($r, $self, $desc);
+	}
 }
 
 sub dump_ibx_start {

      reply	other threads:[~2023-08-24 22:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 22:07 [PATCH] cindex: dump cidx shards before inboxes Eric Wong
2023-08-24 22:14 ` Eric Wong [this message]

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=20230824221414.M803225@dcvr \
    --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.
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).