邮件递送时间长

邮件递送时间长

我的邮件服务器发送电子邮件的时间太长了,从我的邮件日志中我发现延迟值很高。请指导我如何减少队列管理器之前的时间。谢谢。

Jun 26 01:11:21 host postfix/smtpd[20826]: 3CEA53000CC631: client=localhost[127.0.0.1], sasl_method=LOGIN, sasl_username=abc
Jun 26 01:11:21 host postfix/cleanup[20831]: 3CEA53000CC631: message-id=<[email protected]>
Jun 26 01:14:28 host postfix/qmgr[13870]: 3CEA53000CC631: from=<[email protected]>, size=5929654, nrcpt=1 (queue active)
Jun 26 01:14:28 host postfix/pipe[21037]: 3CEA53000CC631: to=<[email protected]>, relay=dfilt, delay=191, delays=191/0.01/0/0.15, dsn=2.0.0, status=sent (delivered via dfilt service)
Jun 26 01:14:28 host postfix/qmgr[13870]: 3CEA53000CC631: removed
Jun 26 01:19:30 host postfix/pickup[13869]: 22B883000CC637: uid=384 from=<[email protected]>
Jun 26 01:19:30 host postfix/cleanup[20831]: 22B883000CC637: message-id=<[email protected]>
Jun 26 01:19:38 host postfix/qmgr[13870]: 22B883000CC637: from=<[email protected]>, size=3926, nrcpt=1 (queue active)
Jun 26 01:19:40 host postfix/smtpd[20773]: connect from gateway[192.168.0.18]
Jun 26 01:19:41 host postfix/smtp[21607]: connect to gmail-smtp-in.l.google.com[2607:f8b0:4002:c06::1b]:25: Network is unreachable
Jun 26 01:19:42 host postfix/smtp[21607]: 22B883000CC637: to=<[email protected]>, relay=gmail-smtp-in.l.google.com[74.125.21.27]:25, delay=230, delays=226/0.01/3.2/0.55, dsn=2.0.0, status=sent (250 2.0.0 OK 1498411182 z187si2453601ybb.86 - gsmtp)
Jun 26 01:19:42 host postfix/qmgr[13870]: 22B883000CC637: removed

这是我的 postfix 配置:

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = mail.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
local_recipient_maps = unix:passwd.byname $alias_maps
unknown_local_recipient_reject_code = 550
mynetworks_style = host
relayhost = 
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
mailbox_command = procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/ MAILDIR=$HOME/Maildir
header_checks = regexp:/etc/postfix/header_checks
mime_header_checks = regexp:/etc/postfix/mime_header_checks.regexp
body_checks = regexp:/etc/postfix/mbl-body-deny
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
smtpd_delay_reject = yes
disable_vrfy_command = yes
strict_rfc821_envelopes = yes
invalid_hostname_reject_code = 554
multi_recipient_bounce_reject_code = 554
non_fqdn_reject_code = 554
relay_domains_reject_code = 554
unknown_address_reject_code = 554
unknown_client_reject_code = 554
unknown_hostname_reject_code = 554
unknown_local_recipient_reject_code = 554
unknown_relay_recipient_reject_code = 554
unknown_sender_reject_code = 554
unknown_virtual_alias_reject_code = 554
unknown_virtual_mailbox_reject_code = 554
unverified_recipient_reject_code = 554
unverified_sender_reject_code = 554
empty_address_recipient = MAILER-DAEMON
message_size_limit = 15000000
mailbox_size_limit = 620000000
local_transport = local
notify_classes = 2bounce,resource,software
bounce_notice_recipient = postmaster
default_process_limit = 200
queue_run_delay = 600s
delay_warning_time = 12h
smtpd_banner = dolphineng.com ESMTP
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 6
smtpd_use_tls = yes
smtpd_tls_key_file = /etc/ssl/certs/mailserverreq.pem
smtpd_tls_cert_file = /etc/ssl/certs/mailserver.pem
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
virtual_alias_maps = hash:/etc/postfix/virtual
smtpd_sender_login_maps = pcre:/etc/postfix/login_maps.pcre
smtpd_sender_restrictions =
    reject_non_fqdn_sender,
        reject_unknown_sender_domain,
    reject_sender_login_mismatch,
    reject_unlisted_sender,
    check_sender_access hash:/etc/postfix/access,
    permit
smtpd_recipient_restrictions =  
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination,
    reject_unknown_address,
    reject_unlisted_recipient,
    reject_invalid_hostname,
    reject_non_fqdn_recipient,
    check_recipient_access pcre:/etc/postfix/recipient_checks.pcre,
    check_sender_access hash:/etc/postfix/access,
    reject_unknown_recipient_domain,
    reject_unknown_sender_domain,
    check_client_access pcre:/etc/postfix/fqrdns.pcre
    reject_sender_login_mismatch,
    reject_non_fqdn_sender,    
    reject_rbl_client zen.spamhaus.org,
        reject_rbl_client bl.spamcop.net,
    reject_rbl_client dnsbl.sorbs.net,
    reject_rbl_client psbl.surriel.com,
    reject_rbl_client b.barracudacentral.org,
    permit
smtpd_data_restrictions =
        reject_unauth_pipelining,
        permit
sender_bcc_maps = hash:/etc/postfix/sender_bcc_maps
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc_maps
smtpd_restriction_classes = local_only
local_only = check_recipient_access hash:/etc/postfix/local_domain, reject
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
smtp_data_xfer_timeout = 600s

答案1

首先,让我们复习一下 中的值的含义delays=(来自delay_logging_resolution_limit):

日志的格式delays=a/b/c/d如下:

  • a = 从消息到达到最后一个活动队列条目的时间
  • b = 从最后一个活动队列条目到连接建立的时间
  • c = 连接建立时间,包括 DNS、EHLO 和 STARTTLS
  • d = 消息传输时间

在您的示例中,只有a增加了,这意味着延迟发生在通过 SASL 认证的客户端的连接期间。客户端消息到达后,一切都发生得很快。这可以得出这样的结论:问题可能不是出在服务器配置上,而是出在客户端连接上。

您的日志中的示例包含两条单独消息的传递。

  1. 3CEA53000CC631以:开头的行delays=191/0.01/0/0.15size=5929654

    这里,消息大小可能是原因。上传速度似乎在 31 kBps 左右,如果同时上传其他内容,这对于客户 DSL 来说是合理的。

  2. 22B883000CC637以:开头的行delays=226/0.01/3.2/0.55size=3926

    由于现在尺寸已经大大减小,我们不能再仅仅责怪上传带宽了。

    我们可以看到,即使第一次尝试在失败的 IPv6 连接上传递消息[2607:f8b0:4002:c06::1b]:25: Network is unreachable,然后在 IPv4 上再次成功传递,延迟c也只增加了 3 秒。您应该修复或禁用 IPv6 连接,但这不是延迟的主要原因。

为了进一步调查,看看在邮件用户代理MUA 连接。

相关内容