Sometime I notice that qpsmtpd is very busy accepting new connections but never getting around to processing them (before they timeout). I wonder if anyone sees any value in being able to tweak the number of accept()s per event loop cycle?

I tried the patch below with some success. As I understand it only accept()s 1 connection on the first event loop cycle and if there were outstanding connections it doubles then # of accept()s from the last cycle until it hits ACCEPT_MAX after which it goes back to 1 (via reset_num_accept()).

Comments?

--- contrib/qpsmtpd/qpsmtpd/qpsmtpd-async 2008-07-07 11:41:24.988192277 -0700
+++ smtpd/qpsmtpd       2008-04-10 11:20:21.066132565 -0700
@@ -44,16 +44,16 @@
 my $USER        = (getpwuid $>)[0];         # user to suid to
    $USER        = "smtpd" if $USER eq "root";
 my $PAUSED      = 0;
-my $NUMACCEPT   = 20;
+my $NUMACCEPT   = 1;
 my $PID_FILE    = '';
 my $ACCEPT_RSET;
 my $DETACH;       # daemonize on startup

 # make sure we don't spend forever doing accept()
-use constant ACCEPT_MAX => 1000;
+use constant ACCEPT_MAX => 8;

 sub reset_num_accept {
-    $NUMACCEPT = 20;
+    $NUMACCEPT = 1;
 }

 sub help {

Reply via email to