Hi All,
I have recently moved by webmail server from a VPS to a hosted dedicated server
running Ubuntu 16.04.
Everything is fine except that login is particularly and consistently long
(around 4-5 seconds).
I have noticed that the process dovecot/auth seems to eat all of the resources
of one of the cores available on the host during login. The authentication
backend is a postgres database which is running absolutely fine.
I have been scavenging on the dovecot mailing list for some time but I have not
been able to find a solution to my problem so decided to send this bottle to the
sea.
Here is my config:
$ sudo dovecot -n
# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 3.14.32-xxxx-grs-ipv6-64 x86_64 Ubuntu 16.04.1 LTS ext4
auth_cache_size = 10 M
auth_mechanisms = plain login
default_internal_user = vmail
first_valid_uid = 0
mail_location = maildir:/home/data/vmail/%d/%n
mail_plugins = " fts fts_solr"
mail_privileged_group = vmail
maildir_stat_dirs = yes
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy
include variables body enotify environment mailbox date index ihave duplicate
mime foreverypart extracttext
namespace inbox {
inbox = yes
location mailbox Archive {
auto = subscribe
special_use = Archive
}
mailbox Drafts {
auto = subscribe
special_use = Drafts
}
mailbox Junk {
auto = subscribe
special_use = Junk
}
mailbox Sent {
auto = subscribe
special_use = Sent
}
mailbox "Sent Messages" {
special_use = Sent
}
mailbox Trash {
auto = subscribe
special_use = Trash
}
prefix }
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
antispam_backend = pipe
antispam_mail_notspam = learn_ham
antispam_mail_sendmail = /usr/bin/rspamc
antispam_mail_sendmail_args = -h;localhost:11334;-P;q1
antispam_mail_spam = learn_spam
antispam_spam = Junk
antispam_trash = Trash
fts = solr
fts_solr = break-imap-search url=http://localhost:8080/solr/
sieve = file:~/sieve;active=~/.dovecot.sieve
sieve_before = /var/lib/dovecot/sieve.d/
}
postmaster_address = postmaster at domain.net
protocols = imap lmtp sieve pop3
service auth-worker {
unix_listener auth-worker {
user = vmail
}
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
group = vmail
mode = 0660
user = vmail
}
user = vmail
}
service imap-login {
inet_listener imap {
port = 0
}
service_count = 1
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0666
user = postfix
}
user = vmail
}
service pop3-login {
inet_listener pop3 {
port = 0
}
}
ssl = required
ssl_cert =
Full dovecot -n output
================# 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 3.14.32-xxxx-grs-ipv6-64 x86_64 Ubuntu 16.04.1 LTS ext4
auth_cache_size = 10 M
auth_mechanisms = plain login
default_internal_user = vmail
first_valid_uid = 0
mail_location = maildir:/home/data/vmail/%d/%n
mail_plugins = " fts fts_solr"
mail_privileged_group = vmail
maildir_stat_dirs = yes
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy
include variables body enotify environment mailbox date index ihave duplicate
mime foreverypart extracttext
namespace inbox {
inbox = yes
location mailbox Archive {
auto = subscribe
special_use = Archive
}
mailbox Drafts {
auto = subscribe
special_use = Drafts
}
mailbox Junk {
auto = subscribe
special_use = Junk
}
mailbox Sent {
auto = subscribe
special_use = Sent
}
mailbox "Sent Messages" {
special_use = Sent
}
mailbox Trash {
auto = subscribe
special_use = Trash
}
prefix }
passdb {
args = /etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
antispam_backend = pipe
antispam_mail_notspam = learn_ham
antispam_mail_sendmail = /usr/bin/rspamc
antispam_mail_sendmail_args = -h;localhost:11334;-P;q1
antispam_mail_spam = learn_spam
antispam_spam = Junk
antispam_trash = Trash
fts = solr
fts_solr = break-imap-search url=http://localhost:8080/solr/
sieve = file:~/sieve;active=~/.dovecot.sieve
sieve_before = /var/lib/dovecot/sieve.d/
}
postmaster_address = postmaster at domain.net
protocols = imap lmtp sieve pop3
service auth-worker {
unix_listener auth-worker {
user = vmail
}
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
group = vmail
mode = 0660
user = vmail
}
user = vmail
}
service imap-login {
inet_listener imap {
port = 0
}
service_count = 1
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0666
user = postfix
}
user = vmail
}
service pop3-login {
inet_listener pop3 {
port = 0
}
}
ssl = required
ssl_cert =
And output from strace, nothing i can make sense of really...
10:38:46.859514 epoll_wait(16, [{EPOLLIN, {u32=1696469520,
u64=15038376972816}}], 17, -1) = 1
10:38:47.768364 accept(7, {sa_family=AF_LOCAL, NULL}, [2]) = 23
10:38:47.768687 getsockname(23, {sa_family=AF_LOCAL,
sun_path="/var/run/dovecot/login/log255r"}, [31]) = 0
10:38:47.768945 fcntl(23, F_GETFL) = 0x2 (flags O_RDWR)
10:38:47.769132 fcntl(23, F_SETFL, O_RDWR|O_NONBLOCK) = 0
10:38:47.769316 write(5, "372f53453", 12) = 12
10:38:47.769529 read(4, "nBW211316333t371341203251206317b367220", 16)
= 16
10:38:47.769747 fstat(23, {st_mode=S_IFSOCK|0777, st_size=0, ...}) = 0
10:38:47.769979 lseek(23, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
10:38:47.770129 getsockname(23, {sa_family=AF_LOCAL,
sun_path="/var/run/dovecot/login/log"e"}, [31]) = 0
10:38:47.770320 epoll_ctl(16, EPOLL_CTL_ADD, 23,
{EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP, {u32=1696840896, u64=15038377344192}}) = 0
10:38:47.770533 write(23, "VERSIONt1t1nMECHtPLAINtplaintext"..., 118)
= 118
10:38:47.770735 epoll_wait(16, [{EPOLLIN, {u32=1696840896,
u64=15038377344192}}], 17, -1) = 1
10:38:47.770927 read(23, "VERSIONt1t1nCPIDt10995n", 8192) = 23
10:38:47.771109 epoll_wait(16, [{EPOLLIN, {u32=1696840896,
u64=15038377344192}}], 17, -1) = 1
10:38:47.916004 read(23, "AUTHt1tPLAINtservice=imaptsecure"..., 8169)
= 145
10:38:47.916428 writev(15, [{"PENALTY-GETt2001:41d0:a::", 25},
{"n", 1}], 2) = 26
10:38:47.916851 epoll_wait(16, [{EPOLLIN, {u32=1696458048,
u64=15038376961344}}], 17, 5000) = 1
10:38:47.917177 read(15, "0 0n", 332) = 4
10:38:47.917478 writev(23, [{"CONTt1t", 7}, {"n", 1}], 2) =
8
10:38:47.917835 read(15, 0xdad65237f68, 328) = -1 EAGAIN (Resource temporarily
unavailable)
10:38:47.918218 epoll_wait(16, [{EPOLLIN, {u32=1696840896,
u64=15038377344192}}], 17, 149998) = 1
10:38:47.919198 read(23, "CONTt1tAG5pY29sYXNAYW5kcmlsbG9uL"..., 8024)
= 52
10:38:49.558718 writev(23, [{"OKt1tuser=address at domain.nett", 32},
{"n", 1}], 2) = 33
10:38:49.558978 epoll_wait(16, [{EPOLLIN, {u32=1696470560,
u64=15038376973856}}], 17, 150000) = 1