python, offlineimap and wakeups (outch)

Sebastian Spaeth Sebastian at SSpaeth.de
Wed Mar 9 11:39:13 UTC 2011


I have just tested our offlineimap behavior with regards to
wakeups (which prevent our system from entering sleep modes).

When idling between refreshs, we currently wake up 20 times per second,
bringing offlineimap into the top 10 offender list on my system. Outch.

Some research revealed the a thread.join() will wake up often too see if
our threads are still alive. And true, invoking offlineimap with the -1
option makes the wakeups go down from 20 to 0.1 per second!

The reason is that we currently even in the "there is only one account
to sync" or "macsyncaccounts=1" situation, spawn an account sync thread
that sleeps and we wait for that thread to finish with a thread.join().

One easy fix in a common situation is to:
 -Not spawning a separate thread in the case that there is only once
  account to sync or maxsyncaccounts=1. This is a trivial change. Within
  that account we would still be multi-threaded.

- Don't run offlineimap in "refresh" daemon mode and invoke it
  periodically from cron. (This is probably quite a clutch)

However, that doesn't help in the case when people sync multiple
accounts in daemon mode and I guess it will require some work to fix
that.

Sebastian



More information about the OfflineIMAP-project mailing list