-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
500 ms delay between sending a message over SMTP and getting IDLE notified #72
Comments
I am considering recompiling |
I have searched the mailing list for The other mention of |
So here is a script
Uncomment Before:
After:
I installed this on nine.testrun.org as this is what we run CI against. |
If we are going to build our own .deb for dovecot, we can also fork https://salsa.debian.org/debian/dovecot/ and setup CI to build a Debian package then publish it into releases. Our patches then go into In this case we can also tweak the build more significantly, e.g. stop building Lua, PostgreSQL, MySQL and LDAP modules by tweaking |
It seems like this "fix" is now our permanent solution, so maybe it's time to close this issue? |
No, because the script is not yet integrated into the repository. It is manually deployed like this on nine.testrun.org, but other chatmail instances actually don't get this improvement yet. |
If we don't manage to get it upsteam, we at least need to have a https://salsa.debian.org/debian/dovecot/ mirror with CI set up to build .deb packages for us. |
alternative proposition: check in pyinfra deploy with apt policy or so whether a new version of dovecot is available, and if yes, build dovecot from source with your script? |
It takes forever to build on a single-core VPS and we cannot build on the client running cmdeploy as it may be an Arch or macOS machine, have no gcc installed etc. |
There is some discussion on the dovecot mailing list regarding how to proceed with upstream fixes: https://dovecot.org/mailman3/archives/list/[email protected]/thread/J2L67F75QW5MJBIRKMBGA2AKNJHRC33X/ |
I have created a PR on the dovecot core repository: dovecot/core#216 I have also created a patched Debian repository for dovecot: https://github.com/chatmail/dovecot To deploy it, run on the server:
It is currently deployed on c20.testrun.org without issues. There is a large tutorial on building forked Debian packages, including doing this with GitHub Actions: https://rdkit-rs.github.io/tutorials/forking-a-debian-package/ |
I have measured round trip time sending messages between two accounts: deltachat/deltachat-core-rust#4974 (comment)
It takes roughly 1.1 seconds to send a message to the echo bot and receive a reply with two Delta Chat accounts. Slightly more than 0.5 seconds (516 or 517 ms) is spent between a mail is sent over SMTP and Dovecot notifies the client in IDLE mode that the message has arrived.
There is a suspicious constant
#define NOTIFY_DELAY_MSECS 500
in Dovecotmailbox-watch.c
:https://github.com/dovecot/core/blob/93a53a9d590f0220de28600f36a969cc38c3148b/src/lib-storage/mailbox-watch.c#L12
mailbox_watch_add
is called from storage implementation. We are using Maildir (may consider switching to dbox, but Maildir is good enough), so in our case it is here:https://github.com/dovecot/core/blob/93a53a9d590f0220de28600f36a969cc38c3148b/src/lib-storage/index/maildir/maildir-storage.c#L632-L645
Here is a
mailbox_notify_changes
which dynamically dispatches to a particular storage implementation:https://github.com/dovecot/core/blob/93a53a9d590f0220de28600f36a969cc38c3148b/src/lib-storage/mail-storage.c#L2473-L2484
And finally, here is IMAP IDLE command implementation using
mailbox_notify_changes
to subscribe for notifications:https://github.com/dovecot/core/blob/93a53a9d590f0220de28600f36a969cc38c3148b/src/imap/cmd-idle.c#L289
So it seems
NOTIFY_DELAY_MSECS 500
directly affects how IDLE callback is called when storage notices changes. And it corresponds with the measurements, it is always slightly more than 500 ms delay.And here is a commit adding it 14 years ago:
dovecot/core@56fb5d0
It reads:
The text was updated successfully, but these errors were encountered: