[dev] I/O hammering (was: imp folder prefix)

Egan egan@sevenkings.net
Wed, 30 May 2001 15:44:15 -0400


On Wed, 30 May 2001 14:41:22 -0400, Chuck Hagenbuch <chuck@horde.org>
wrote:

>I've done some work to see if we can get any better with the current PHP 
>functions.

I've been looking at php_imap.c, and I think we can do a lot better by
tweaking it.

As the trace showed, IMP did do one sequence fetch, before it started
its multi-step retrieval cycle.  Grepping php_imap.c for functions
which take **sequence instead of just a single message number input, I
only see a few:

  imap_delete
  imap_undelete
  imap_setflag_full
  imap_clearflag_full
  imap_fetch_overview

Obviously, the only interesting one is imap_fetch_overview.  What is
puzzling me at this point, is that grepping the IMP source, I don't
see any calls to imap_fetch_overview, so I don't yet understand how
IMP generated that one sequence fetch in the trace.  But something
caused it; it's there in the trace.

Anytime we need information for building a list of messages, maximum
performance will be obtained by making a single call to a single
function which accepts a sequence.  Just making that one design change
will eliminate at least 90% of the server communication overhead we
have now for building the message list; that would make it as fast as
it could possibly be.

So it seems to me, an enhanced imap_fetch_overview is what we need.

By enhancing it to also request BODYSTRUCTURE for a sequence, then to
get the information needed for building the message list, we should be
able to replace that entire looping business with a single call to our
enhanced version of imap_fetch_overview.

If you agree in principle, I will start looking at what's needed to
accomplish that in php_imap.c.


Egan