Loading ...
Sorry, an error occurred while loading the content.

Re: PATCH: poor SMTP/Milter performance over loopback (127.0.0.1 etc)

Expand Messages
  • Victor Duchovni
    ... Perhaps something along the lines of (untested, applied with Wietse s patch): Index: milter/milter8.c ... +++ milter/milter8.c 30 Jul 2007 16:22:17 -0000
    Message 1 of 30 , Jul 30, 2007
    • 0 Attachment
      On Mon, Jul 30, 2007 at 11:39:17AM -0400, Victor Duchovni wrote:

      > On Mon, Jul 30, 2007 at 05:08:26PM +0200, Mark Martinec wrote:
      >
      > > > Below is a proposed patch that fixes the problem for Postfix 2.4
      > > > and Postfix 2.5. When the TCP maximal segment size (MSS) is larger
      > > > than the VSTREAM buffer size, the patch increases the VSTREAM buffer
      > > > size to avoid Nagle delays.
      > >
      > > Hmm. I applied the patch to the postfix-current (2.5-20070724)
      > > from ports (FreeBSD 6.2). Although I do see a
      > > vstream_tweak_tcp: TCP_MAXSEG 14336
      >
      > The patch appears to be incomplete, one needs to tweak the vstream
      > buffer size not only when the milter connection is created in smtpd(8)
      > via milter8_connect(), but also when the milter is passed to cleanup(8)
      > via milter8_receive():
      >
      > milter->fp = vstream_fdopen(fd, O_RDWR);
      > vstream_control(milter->fp, VSTREAM_CTL_DOUBLE, VSTREAM_CTL_END);
      >
      > We need to detect wether the milter is an "inet" or a "unix" socket,
      > and if "inet," call:
      >
      > vstream_tweak_tcp(milter->fp);
      >

      Perhaps something along the lines of (untested, applied with Wietse's patch):

      Index: milter/milter8.c
      --- milter/milter8.c 30 Jul 2007 15:31:47 -0000 1.1.1.4.2.1
      +++ milter/milter8.c 30 Jul 2007 16:22:17 -0000
      @@ -2451,6 +2451,8 @@
      int cmd_timeout;
      int msg_timeout;
      int fd;
      + SOCKADDR_SIZE sa_length;
      + struct sockaddr sa;

      if (name_buf == 0) {
      name_buf = vstring_alloc(10);
      @@ -2496,6 +2498,18 @@
      msg_timeout, NO_PROTOCOL, STR(act_buf), parent);
      milter->fp = vstream_fdopen(fd, O_RDWR);
      vstream_control(milter->fp, VSTREAM_CTL_DOUBLE, VSTREAM_CTL_END);
      +
      + sa_length = sizeof(sa);
      + if (getsockname(vstream_fileno(milter->fp), &sa, &sa_length) >= 0)
      + switch(sa.sa_family) {
      +#ifdef AF_INET6
      + case AF_INET6:
      +#endif
      + case AF_INET:
      + vstream_tweak_tcp(milter->fp);
      + break;
      + }
      +
      milter->version = version;
      milter->rq_mask = rq_mask;
      milter->ev_mask = ev_mask;

      --
      Viktor.

      Disclaimer: off-list followups get on-list replies or get ignored.
      Please do not ignore the "Reply-To" header.

      To unsubscribe from the postfix-users list, visit
      http://www.postfix.org/lists.html or click the link below:
      <mailto:majordomo@...?body=unsubscribe%20postfix-users>

      If my response solves your problem, the best way to thank me is to not
      send an "it worked, thanks" follow-up. If you must respond, please put
      "It worked, thanks" in the "Subject" so I can delete these quickly.
    Your message has been successfully submitted and would be delivered to recipients shortly.