From d1024533712e32fde9c9812e604661ffc9e79019 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 5 Aug 2022 08:29:54 +0000 Subject: daemon: dedupe PublicInbox::Config objects by pathname This means all Inbox, Git, Over, Msgmap, Search objects also get deduplicated if they belong to the same config file, reducing memory and FD usage. This helps save memory and improve cache hit rates in -netd setups where NNTP, IMAP, HTTP, and POP3 servers run in the same process. InboxIdle was the only bit which needed adjustment, but there may be other bugs lurking despite all tests passing. --- lib/PublicInbox/Daemon.pm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/PublicInbox/Daemon.pm') diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 86234771..b6f4f9ed 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -22,6 +22,7 @@ use PublicInbox::Sigfd; use PublicInbox::Git; use PublicInbox::GitAsyncCat; use PublicInbox::Eml; +use PublicInbox::Config; our $SO_ACCEPTFILTER = 0x1000; my @CMD; my ($set_user, $oldset); @@ -653,8 +654,10 @@ sub defer_accept ($$) { sub daemon_loop ($) { my ($xnetd) = @_; + local $PublicInbox::Config::DEDUPE = {}; # enable dedupe cache my $refresh = sub { my ($sig) = @_; + %$PublicInbox::Config::DEDUPE = (); # clear cache for my $xn (values %$xnetd) { delete $xn->{tlsd}->{ssl_ctx}; # PublicInbox::TLS::start eval { $xn->{refresh}->($sig) }; -- cgit v1.2.3-24-ge0c7