Jonathan Siegle schreef:
On Jul 30, 2009, at 1:29 PM, Timo Sirainen wrote:
On Thu, 2009-07-30 at 11:30 -0400, Jonathan Siegle wrote:
I recently found out about something called memcached. The goal of memcached(server)[1] and libmemcached(client library)[2] is to store maps in memory of tokens. So my key would be "jsiegle_sieve" and my data would be my sieve file. So instead of the 10-20 million reads to disk, we would just pull from memory.
Then again, if you have enough memory your OS could be doing that automatically already.
Good point. AIX does love to use memory to cache filesystems. I think I'll try to do some formal testing. The hooks appear to be fairly easy to put into the sieve code.
Or maybe if the Sieve plugin supports giving a separate path to downloaded scripts, the destination could be in a ramdisk or if you're using Linux: http://memcachefs.sourceforge.net/
It doesn't do that now, but when this becomes important, I'll be able to add this quickly.
Also I'm hopefully going to abstracting out filesystem accessing code in Dovecot's index files and dbox code. Sieve could use this same FS API, and you could implement whatever backend to actually perform the FS access, like memcached.. Ok, that would be nice.
Are you saying that it isn't possible to put the memcached hooks in now until this work is done? It looks like I just put hooks into sieve_script_init() to read from memcached before disk.
That would miss your goal, simply because the sieve_script object refers to the actual script file, which is only used during compilation. If stat() calls are also an concern, you will need to patch this too, but your main target should be the sieve_binary, since that is used to access the compiled binary each time a message is delivered.
My priorities are not such that I am prepared implement this myself any time soon, but I am willing to accept a patch if you want to build this yourself.
Regards,
-- Stephan Bosch stephan@rename-it.nl