我们为每周新闻通讯而设立的新 postfix 服务器似乎非常慢,其所用时间是 1&1 的旧服务器的两倍多。
最近几天,我尽可能遵循本指南,试图找出问题所在。 http://www.postfix.org/TUNING_README.html
因此,在我的测试组中,我向我们域内的所有 440 个收件人发送邮件,只是为了测试目的。
我们旧的 1&1 smtp 大约需要 7 - 10 分钟,我们自己的 postfix 需要 20 到 30 分钟。htop 中的负载始终很低:CPU 徘徊在 2 - 5% 左右,内存为 200MB/4GB。在 iotop 中,我看到的最高总磁盘写入速度约为 200kb/s。
正如上面的指南所述,我在发送时查看了 qshape 输出,但队列几乎一直都是空的。
我希望有人能给我们一些提示,告诉我们哪里可以找到问题,任何帮助都将不胜感激。
以下是发送时 iostat 的输出:
Linux 4.4.27-x86_64-jb1 (j3XXXXXX.servers.xxxxxxxx.net) 02/22/2017 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.25 0.04 0.34 0.01 0.01 99.37
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
xvda 0.84 4.70 14.43 384062 1180244
xvdb 0.00 0.01 0.00 468 0
这是发送给我们的测试组时的邮件日志:
Feb 22 09:22:24 j3XXXXXX postfix/smtpd[3333]: connect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:26 j3XXXXXX postfix/smtpd[3333]: 2684A42D0B: client=superwebmailer[93.180.XXX.XXX], sasl_method=LOGIN, [email protected]
Feb 22 09:22:26 j3XXXXXX postfix/cleanup[3334]: 2684A42D0B: message-id=<[email protected]>
Feb 22 09:22:26 j3XXXXXX postfix/qmgr[3174]: 2684A42D0B: from=<[email protected]>, size=124666, nrcpt=1 (queue active)
Feb 22 09:22:26 j3XXXXXX postfix/smtpd[3333]: disconnect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:26 j3XXXXXX postfix/smtp[3327]: 2684A42D0B: to=<[email protected]>, relay=mx00.kundenserver.de[212.227.15.41]:25, delay=0.17, delays=0.01/0/0.03/0.13, dsn=2.0.0, status=sent (250 Requested mail action okay, completed: id=0M3qVy-1cPTIu0nOk-00rbOr)
Feb 22 09:22:26 j3XXXXXX postfix/qmgr[3174]: 2684A42D0B: removed
Feb 22 09:22:26 j3XXXXXX postfix/smtpd[3333]: connect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:28 j3XXXXXX postfix/smtpd[3333]: 331F542D0B: client=superwebmailer[93.180.XXX.XXX], sasl_method=LOGIN, [email protected]
Feb 22 09:22:28 j3XXXXXX postfix/cleanup[3334]: 331F542D0B: message-id=<[email protected]>
Feb 22 09:22:28 j3XXXXXX postfix/qmgr[3174]: 331F542D0B: from=<[email protected]>, size=124666, nrcpt=1 (queue active)
Feb 22 09:22:28 j3XXXXXX postfix/smtpd[3333]: disconnect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:28 j3XXXXXX postfix/smtp[3326]: 331F542D0B: to=<[email protected]>, relay=mx00.kundenserver.de[212.227.15.41]:25, delay=0.19, delays=0.01/0/0.03/0.15, dsn=2.0.0, status=sent (250 Requested mail action okay, completed: id=0M5mJx-1cQrHx11WT-00xvuo)
Feb 22 09:22:28 j3XXXXXX postfix/qmgr[3174]: 331F542D0B: removed
Feb 22 09:22:28 j3XXXXXX postfix/smtpd[3333]: connect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:30 j3XXXXXX postfix/smtpd[3333]: D390F42D0B: client=superwebmailer[93.180.XXX.XXX], sasl_method=LOGIN, [email protected]
Feb 22 09:22:30 j3XXXXXX postfix/cleanup[3334]: D390F42D0B: message-id=<[email protected]>
Feb 22 09:22:30 j3XXXXXX postfix/qmgr[3174]: D390F42D0B: from=<[email protected]>, size=124666, nrcpt=1 (queue active)
Feb 22 09:22:30 j3XXXXXX postfix/smtpd[3333]: disconnect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:31 j3XXXXXX postfix/smtp[3327]: D390F42D0B: to=<[email protected]>, relay=mx00.kundenserver.de[212.227.15.41]:25, delay=0.21, delays=0.01/0/0.03/0.17, dsn=2.0.0, status=sent (250 Requested mail action okay, completed: id=0LsRC8-1cDwze3m9I-0122lz)
Feb 22 09:22:31 j3XXXXXX postfix/qmgr[3174]: D390F42D0B: removed
Feb 22 09:22:31 j3XXXXXX postfix/smtpd[3333]: connect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:33 j3XXXXXX postfix/smtpd[3333]: 4077542D0B: client=superwebmailer[93.180.XXX.XXX], sasl_method=LOGIN, [email protected]
Feb 22 09:22:33 j3XXXXXX postfix/cleanup[3334]: 4077542D0B: message-id=<[email protected]>
Feb 22 09:22:33 j3XXXXXX postfix/qmgr[3174]: 4077542D0B: from=<[email protected]>, size=124666, nrcpt=1 (queue active)
Feb 22 09:22:33 j3XXXXXX postfix/smtpd[3333]: disconnect from superwebmailer[93.180.XXX.XXX]
Feb 22 09:22:33 j3XXXXXX postfix/smtp[3326]: 4077542D0B: to=<[email protected]>, relay=mx00.kundenserver.de[212.227.15.41]:25, delay=0.16, delays=0.01/0/0.04/0.1, dsn=2.0.0, status=sent (250 Requested mail action okay, completed: id=0MGKrT-1cbHfq1Ivf-00FB48)
Feb 22 09:22:33 j3XXXXXX postfix/qmgr[3174]: 4077542D0B: removed
有时 postfix/anvil 会记录以下内容:
Feb 22 09:12:26 j3XXXXXX postfix/anvil[3178]: statistics: max connection rate 27/60s for (smtp:93.180.XXX.XXX) at Feb 22 09:09:05
Feb 22 09:12:26 j3XXXXXX postfix/anvil[3178]: statistics: max connection count 1 for (smtp:93.180.XXX.XXX) at Feb 22 09:02:27
这是我们的postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
default_destination_concurrency_limit = 40
default_process_limit = 700
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 100
inet_interfaces = all
inet_protocols = all
initial_destination_concurrency = 10
local_transport = virtual
mailbox_size_limit = 0
mydestination = localhost.mail.xxxxxxx.xxx, j3XXXXXX.servers.xxxxxxxx.net, localhost.servers.xxxxxxxx.net, localhost
myhostname = mail.xxxxxxx.xxx
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_nam
smtpd_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_sasl_path = private/auth_dovecot
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
smtpd_sender_restrictions = reject_unknown_sender_domain
smtpd_tls_cert_file = /etc/postfix/ssl/mailserver.crt
smtpd_tls_key_file = /etc/postfix/ssl/mailserver.key
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_gid_maps = static:6000
virtual_mailbox_base = /var/vmail/
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual-domains-maps.cf
virtual_mailbox_limit = 0
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_minimum_uid = 104
virtual_transport = dovecot
virtual_uid_maps = static:6000