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

Re: strange delay in pre-queue phase

Expand Messages
  • Wietse Venema
    ... This means that some client implementation does small writes back-to-back, and therefore the client suffers from Nagle delays. ... The client
    Message 1 of 4 , Jul 1, 2011
    • 0 Attachment
      Oliver Schonrock:
      > However...
      > When sending it from a machine which has Sendmail installed and I use
      > the sendmail "client" binary which comes with that the delay is 10x
      > greater ~0.1s.

      This means that some client implementation does small writes
      back-to-back, and therefore the client suffers from Nagle delays.

      > I also get the larger delay when sending using a userland php library
      > (my actually use case).
      >
      > When using my php library I was able to isolate the delay to the
      > END_OF_DATA command ie
      >
      > <CR><LF>.<CR>LF>

      The client implementation does small writes back-to-back, i.e. it
      sends the last portion of the message in one write operation and
      then it sends <CR><LF>.<CR>LF> in another write operation.

      This means that the client implementation does small writes
      back-to-back, and therefore the client suffers from Nagle delays.

      The fix is for the client to append <CR><LF>.<CR>LF> to the message
      content before writing it to the network.

      The workaround is for the client to turn off Nagle delays.

      Wietse
    • Oliver Schonrocks
      ... Thanks. That was it for sure. Just for the benefit of others: - it was hard for me to change the php client library, although I have posted a bug for Swift
      Message 2 of 4 , Jul 4, 2011
      • 0 Attachment
        On 01/07/11 19:24, Wietse Venema wrote:
        > The fix is for the client to append<CR><LF>.<CR>LF> to the message
        > content before writing it to the network.
        >
        > The workaround is for the client to turn off Nagle delays.

        Thanks. That was it for sure.

        Just for the benefit of others:

        - it was hard for me to change the php client library, although I have
        posted a bug for Swift Mailer
        http://swiftmailer.lighthouseapp.com/projects/21527-swift-mailer/tickets/204-nagle-delays-affect-mail-sending-throughput

        - it was also hard to change the client to turn off Nagle delays,
        because Swift Mailer is using the wrong php library to allow that.

        So I changed the system wide Nagle behaviour on the server, which is a
        freebsd system.

        http://lists.freebsd.org/pipermail/freebsd-stable/2008-June/043325.html

        sysctl net.inet.tcp.delacktime=10
        # (default 100ms)

        Which reduced 90% of the delay.

        Not ideal, but fine in this case, since most of the traffic to that
        hosts is LAN or very high speed WAN.

        Thanks again.

        --
        Oliver Schonrock
      Your message has been successfully submitted and would be delivered to recipients shortly.