Subject: cache size limitation

From: Harrie Hazewinkel <[email-masked]>
Date: Thu, 6 Feb 2003 16:37:59 +0100

HI,

I was wondering if some one has been succefull in limiting the
size of the message cache of a mailstream in the 'imapd' daemon.
What I want to do is limit the amount of memory usage per
process/imapd daemon, since a process can become real big
in memory footprint when it handles a mailbox of over 1000 of emails.

I understood I could write my of cache function, by means
of implementing a function like mm_cache and do a
mail_parameters(NIL, SET_CACHE, my_cache) during the init
phase, but (correct me if I am wrong) the imap-daemon needs
the complete set of message in a cache arrray in order to
responds properly to a client.

I did a small expiriment with my own cache function in which
I just kept a single message in cache. Then in case of a
'UID FETCH' no message information is returned to the client.
Just directly the OK, even though it does a complete parse of
a mailbox.

Harrie
------------------------------------------------------------------
Author of MOD-SNMP, enabling SNMP management of Apache HTTP server

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Thu, 6 Feb 2003 09:32:30 -0800 (PST)

> in memory footprint when it handles a mailbox of over 1000 of emails.

1000 messages is not "really big".  10,000 messages is "big", and 100,000
messages is "really big".

I suggest that if you find that if you are having memory problems with
small 1000 message mailboxes, that you spend a few Euros to increase your
memory to an adequate size.  The last time I bought memory, it was US
$.33/MB.  It's probably cheaper now.

You will waste much more money in CPU resources and in human time than you
will save by not buying adequate memory.

> responds properly to a client.

You can swap things out to disk by using a SET_CACHE function.  That's
what we did in 16-bit Windows.  I don't think that any of us ever again
want to do that (you'll notice that we no long build 16-bit versions of
Pine).

> Just directly the OK, even though it does a complete parse of

That's because you didn't change the cached message to be the one that
imapd is referencing.  You can't just return nulls.

Getting a SET_CACHE function right is a lot of work.  I doubt that you
would ever recover the costs of your development in savings from not
buying memory.  We spent a long long time building the SET_CACHE technoogy
in the c-client library and in using it in Pine, and we were very happy to
abandon it totally in Pine 4.00.

That is another thing; SET_CACHE hasn't been used by us in a very long
time.  I don't think that I've done anything to break it in c-client, but
since it hasn't been used it hasn't been tested in several years.  You
should expect to encounter problems.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.