On Oct 13, 2009, at 6:28 PM, Ed W wrote:
Perhaps I misunderstand, but doesn't dovecot send a "keepalive" on
connections which are idling?
Yes, it's configurable nowadays:
# How many seconds to wait between "OK Still here" notifications when # client is IDLEing. #imap_idle_notify_interval = 120
And I did think of that in my previous mail, but then thought it
wasn't relevant because client was only receiving data, but now I
realized that of course the client will also have to send back TCP ACK.
I can imagine that in the case of a typical cell phone with say 3
email accounts, there will be likely three idle connections (or
more) to dovecot and each will end up sending keepalive packets at
slightly different intervals for each connection. By synchronising
this network traffic you would potentially increase battery life by
up to a factor of 3 (ie turn on the radio to send the keepalive for
all connections in one go, rather than turning the radio on three
times as often)... (I think perhaps that's optimistic, but you can
see that quite large gains might be possible here)
Oh. That does sound like a good idea. Hmm. I think there's an easy way
to implement this:
next_still_here_sending_timestamp = imap_idle_notify_interval - (time(NULL) + crc32(username)) % imap_idle_notify_interval;
The username CRC32 is there to avoid network/load spikes when all the
processes try to send the "Still here" at the same time.