On Wed, Oct 12, 2022 at 12:36:21PM +0200, juan smitt wrote:

> The clients are very sensitive to the mail service's response time (we
> can't do anything with that).

If they're that latency sensitive, they should switch from SMTP to HTTP
POST.  The SMTP is not an instant messaging protocol, and is not
optimised to minimise RTT count or other sources of latency.

> According to this example, is it true that the client considers the
> email delivered when we see the "(queue active)" entry in the log
> whatever happens to the mail later?

No, the message entering the active queue happens at some point later.
Usually the gap is short, but not always.  The queue manager could be
busy, or the active queue could be full.

> Can we calculate the delay based on the time difference between the
> "client" and the "queue active" lines?

No.  Because from the client's perspective message delivery likely
starts when it decides to start the TCP connection, while "client=" is
logged when the first valid "RCPT TO" is accepted.  So as Wietse pointed
out, various other delays are not included:

    * Client side DNS resolution of the SMTP server name
    * TCP connection setup
    * Postfix server process startup (if not reused)
    * Postfix resolution of the client's IP address to name and
      then name to address
    * 220 banner transmission 
    * EHLO processing
    * Possible STARTTLS + TLS Handshake + EHLO
    * Possible SMTP SASL AUTH
    * MAIL FROM:
        - Possible LDAP or SQL lookup delays
        - Possible policy service delays
        - Possible RBL lookup delays
        - Possible milter processing delays
    * RCPT TO:
        - Possible LDAP or SQL lookup delays
        - Possible policy service delays
        - Possible RBL lookup delays
        - Possible milter processing delays

If the client is using a dedicated SMTP submission service that is
not reachable by botnets, then it could be tuned to minimise the
amount of work performed as part of inbound message processing.

> 10:23:16+00:00 mailserver postfix/smtpd[1569925]: 4MnTJ40Gttz7vqf:
> client=client.fqdn[client.ip]
> 10:23:16+00:00 mailserver postfix/qmgr[1563391]: 4MnTJ40Gttz7vqf:
> from=<t...@testsender.fqdn>, size=5375, nrcpt=1 (queue active)

This time delta is a rough estimate.  Your syslog service may
support logging more fine-grained timestamps (with milliseconds).

-- 
    Viktor.

Reply via email to