Performance hack

1999-08-25 Thread Andre Oppermann

Attached is a small performance hack to qmail-remote.

It simply disables the delayed ack for tcp connections. Speeds the
beginning of the data transfer phase up by about 0.5 seconds.
The effect is a little bit depending on your platform. On FreeBSD it
almost doubles the number of messages that can be sent in a certain
amount of time (in my test environment). It helps most if you have
lots of small messages.

Got the TCP-NODELAY tip from a different discussion on the FreeBSD
ML and the conclusion there was that it helps most on *BSD, Solaris
and basically all other unices exept Linux. I have no idea why that
and it doesn't really matter because in this aspect Linux is also
fine w/o this optimization (well, it doesn't hurt, the gain is just
not so high).

I'd like to see how much it speeds huge mailing lists up (I don't
have huge ML).

This will be also included in next qmail-ldap.

-- 
Andre


% cvs diff -u -r1.1 qmail-remote.c
Index: qmail-remote.c
===
RCS file: /usr/home/opi/CVS/qmail-ldap/qmail-remote.c,v
retrieving revision 1.1
retrieving revision 1.3
diff -u -r1.1 -r1.3
--- qmail-remote.c  1999/03/23 19:40:09 1.1
+++ qmail-remote.c  1999/08/25 17:59:28 1.3
@@ -1,6 +1,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "sig.h"
 #include "stralloc.h"
@@ -413,6 +414,9 @@

 smtpfd = socket(AF_INET,SOCK_STREAM,0);
 if (smtpfd == -1) temp_oserr();
+
+/* performace hack to send TCP ACK's without delay */
+setsockopt(smtpfd, IPPROTO_TCP, TCP_NODELAY, &smtpfd, sizeof
smtpfd);

 if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int)
port,timeoutconnect) == 0) {
   tcpto_err(&ip.ix[i].ip,0);



Re: Performance hack

1999-08-25 Thread Andre Oppermann

Oh well, I'm a little bit stupid today... Forgot to check the real
patch into cvs.

This is the actual working patch I used for my tests:

% cvs diff -u -r1.1 qmail-remote.c
Index: qmail-remote.c
===
RCS file: /usr/home/opi/CVS/qmail-ldap/qmail-remote.c,v
retrieving revision 1.1
retrieving revision 1.4
diff -u -r1.1 -r1.4
--- qmail-remote.c  1999/03/23 19:40:09 1.1
+++ qmail-remote.c  1999/08/25 21:32:28 1.4
@@ -1,6 +1,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "sig.h"
 #include "stralloc.h"
@@ -332,6 +333,7 @@
 {
   static ipalloc ip = {0};
   int i;
+  int tcpnodelay = 1;
   unsigned long random;
   char **recips;
   unsigned long prefme;
@@ -413,6 +415,9 @@

 smtpfd = socket(AF_INET,SOCK_STREAM,0);
 if (smtpfd == -1) temp_oserr();
+
+/* performace hack to send TCP ACK's without delay */
+setsockopt(smtpfd, IPPROTO_TCP, TCP_NODELAY, &tcpnodelay, sizeof
tcpnodelay);

 if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int)
port,timeoutconnect) == 0) {
   tcpto_err(&ip.ix[i].ip,0);