Re: Expiring Kolab objects cache in Roundcube

Thomas Brüderli <[email protected]>
Newsgroups gmane.comp.kde.devel.kolab
Message-ID <502CAE68.1000704__41369.3027374849$1345105540$gmane$org@kolabsys.com>
Jeroen van Meeuwen wrote:
> On Saturday, June 09, 2012 02:39:04 PM Thomas Brüderli wrote:
>> Hello
>
> Hi Thomas,
>
>> The new storage layer for Kolab 3.0 in Roundcube slowly grows up and it
>> also provides caching of Kolab objects in the local (My)SQL database. The
>> cache is persistent and synchronized with the IMAP mailbox on every access.
>> This means that all objects of each resource every accessed through the web
>> client have a copy in the local cache. You can easily imagine the growth of
>> that cache. So we need some strategy how to expire and remove cache objects
>> in a way that keeps good balance between access speed and storage volume.
>> Here are a few thoughts how that might be achieved:
>
>> 1) Clear user's cache when a user terminates a session
>> 2) Cronjob which removes cache objects older than T - <cache-lifetime>
>> 3) Same as 2) but triggered randomly on web client requests (no cronjob)
>
> [...]
>
>> I'd therefore propose either 2) or 3). [...]
>
> Concerning user mutations (change of primary unique ID / result
> attribute used as identifier in Roundcube, currently the first 'mail'
> attribute value, or user deletion), I'm already in the progress of
> building a Roundcube plugin to the Kolab daemon, that can hook itself up
> to the database and make those changes.
>
> It'd be easiest if we were able to develop a command-line script that
> can synchronize cache* table entries with what exists in the users table
> at that moment, so that the daemon can restrict itself to a limited
> number of columns to update in the users table, and a simple delete on
> the users table.

Such a command line script is now available in 
plugins/libkolab/bin/modcache.sh. It accepts different commands such as 
'expunge', 'clear' or 'prewarm'.

Since caches are shared amongst users who shared some their folders, 
there's no simple SQL query to remove caches of a deleted user. The use 
of this dedicated script is recommended in such cases.

For clearing a deleted user's cache, call it as follows:
modcache.sh -h <kolab-host> clear <username>
>
> I think this might both help in pre-seeding caches for a user's (large)
> folders, as well as expiring cache* table entries.

For pre-seeding the cache of a specific user, call it as follows:
modcache.sh -h <host> -u <auth-user> -t <object-type> prewarm <username>

In order to avoid interactive password prompts, add -p <password> to the 
command.

The script hasn't been tested or used in production yet so please report 
bugs and enhancement requests to bugzilla.

Cheers,
Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.