Have xCAT more aggressively drain the listen queue on the main listening socket.
This change manages to have xCAT successfully field a large amount of incoming connections with a relatively small listen queue. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11932 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
4bb34e0e92
commit
7c64bb6b05
@ -823,6 +823,7 @@ while (not $listener and $retry) {
|
||||
}
|
||||
sleep(0.05);
|
||||
}
|
||||
my $listenwatcher = IO::Select->new($listener);
|
||||
|
||||
unless ($listener) {
|
||||
kill 2, $pid_UDP;
|
||||
@ -840,13 +841,28 @@ open($mainpidfile,">","/tmp/xcat/mainservice.pid"); #if here, everyone else has
|
||||
print $mainpidfile $$;
|
||||
close($mainpidfile);
|
||||
closelog();
|
||||
my @pendingconnections;
|
||||
my $tconn;
|
||||
until ($quit) {
|
||||
$SIG{CHLD} = \&ssl_reaper; #set here to ensure that signal handler is not corrupted during loop
|
||||
next unless my $cnnection=$listener->accept;
|
||||
my $connection;
|
||||
while ($sslclients > $maxsslclients) { #THROTTLE
|
||||
sleep 0.1; #Keep processor utilization down
|
||||
if (@pendingconnections) {
|
||||
while ($listenwatcher->can_read(0)) { #grab everything we ca
|
||||
$tconn = $listener->accept;
|
||||
unless ($tconn) { next; }
|
||||
push @pendingconnections,$tconn;
|
||||
}
|
||||
} else {
|
||||
$tconn = $listener->accept;
|
||||
unless ($tconn) { next; }
|
||||
push @pendingconnections,$tconn;
|
||||
}
|
||||
unless (scalar @pendingconnections) { next; }
|
||||
if ($sslclients > $maxsslclients) { #THROTTLE
|
||||
$listenwatcher->can_read(0.1); #when next connection tries to come in or a tenth of a second, whichever comes first
|
||||
next; #just keep pulling things off listen queue onto our own
|
||||
}
|
||||
my $cnnection=shift @pendingconnections;
|
||||
my $connection;
|
||||
my $child = xCAT::Utils->xfork(); #Yes we fork, IO::Socket::SSL is not threadsafe..
|
||||
if ($child) {
|
||||
$immediatechildren{$child}=1;
|
||||
|
Loading…
Reference in New Issue
Block a user