From cd50d183273c105a7f08b1875ba6f7a51d9f8e9a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 May 2019 10:34:08 +0000 Subject: bundle Danga::Socket and Sys::Syscall These modules are unmaintained upstream at the moment, but I'll be able to help with the intended maintainer once/if CPAN ownership is transferred. OTOH, we've been waiting for that transfer for several years, now... Changes I intend to make: * EPOLLEXCLUSIVE for Linux * remove unused fields wasting memory * kqueue bugfixes e.g. https://rt.cpan.org/Ticket/Display.html?id=116615 * accept4 support And some lower priority experiments: * switch to EV_ONESHOT / EPOLLONESHOT (incompatible changes) * nginx-style buffering to tmpfile instead of string array * sendfile off tmpfile buffers * io_uring maybe? --- lib/PublicInbox/Listener.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/Listener.pm') diff --git a/lib/PublicInbox/Listener.pm b/lib/PublicInbox/Listener.pm index 52894cb3..d1f0d2e9 100644 --- a/lib/PublicInbox/Listener.pm +++ b/lib/PublicInbox/Listener.pm @@ -5,7 +5,7 @@ package PublicInbox::Listener; use strict; use warnings; -use base 'Danga::Socket'; +use base 'PublicInbox::DS'; use Socket qw(SOL_SOCKET SO_KEEPALIVE IPPROTO_TCP TCP_NODELAY); use fields qw(post_accept); require IO::Handle; -- cgit v1.2.3-24-ge0c7 From 5aaea61844b92c452c201ce9832e3c5c68c6f84e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 3 May 2019 10:34:09 +0000 Subject: listener: use EPOLLEXCLUSIVE for listen sockets Since our listen sockets are non-blocking and we may run multiple httpd|nntpd processes; we need a way to avoid thundering herds when there are multiple httpd|nntpd worker processes. EPOLLEXCLUSIVE was added just for that in Linux 4.5 --- lib/PublicInbox/Listener.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/PublicInbox/Listener.pm') diff --git a/lib/PublicInbox/Listener.pm b/lib/PublicInbox/Listener.pm index d1f0d2e9..a75a6fd9 100644 --- a/lib/PublicInbox/Listener.pm +++ b/lib/PublicInbox/Listener.pm @@ -17,7 +17,7 @@ sub new ($$$) { listen($s, 1024); IO::Handle::blocking($s, 0); my $self = fields::new($class); - $self->SUPER::new($s); # calls epoll_create for the first socket + $self->SUPER::new($s, 1); # calls epoll_create for the first socket $self->watch_read(1); $self->{post_accept} = $cb; $self -- cgit v1.2.3-24-ge0c7