From f75c6cf666fa202da782de43fd150bbeceb734e4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 23 Feb 2021 04:01:15 -0600 Subject: lei q: reduce default lei2mail workers While disk I/O is typically buffered for good scheduling, git blob decoding uses a non-trivial amount of CPU time and it helps to leave some CPU available for it. --- lib/PublicInbox/LeiQuery.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/PublicInbox/LeiQuery.pm') diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index 214267ee..743fa3f7 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -5,6 +5,7 @@ package PublicInbox::LeiQuery; use strict; use v5.10.1; +use POSIX (); sub prep_ext { # externals_each callback my ($lxs, $exclude, $loc) = @_; @@ -94,7 +95,10 @@ sub lei_q { return $self->fail("`$mj' writer jobs must be >= 1"); } PublicInbox::LeiOverview->new($self) or return; - $self->{l2m}->{-wq_nr_workers} = ($mj // $nproc) if $self->{l2m}; + $self->{l2m} and $self->{l2m}->{-wq_nr_workers} = $mj // do { + $mj = POSIX::lround($nproc * 3 / 4); # keep some CPU for git + $mj <= 0 ? 1 : $mj; + }; my %mset_opt = map { $_ => $opt->{$_} } qw(threads limit offset); $mset_opt{asc} = $opt->{'reverse'} ? 1 : 0; -- cgit v1.2.3-24-ge0c7