Kozea / Radicale

A simple CalDAV (calendar) and CardDAV (contact) server.
https://radicale.org
GNU General Public License v3.0
3.39k stars 444 forks source link

Separating the cache folder from the filesystem_folder #1640

Open NovaIQCorp opened 5 days ago

NovaIQCorp commented 5 days ago

I am deploying a Radicale server on Google Cloud using Google Cloud Services. I’ve mounted a bucket inside the container to provide data access to Radicale. However, Radicale writes its cache into the same folder as the data, which results in poor network I/O performance.

To address this, I’d like to separate the cache folder from the files. This way, the cache folder can reside locally on the container rather than in the mounted bucket.

Currently, the cache location is determined based on the following line of code in Radicale’s source:

https://github.com/Kozea/Radicale/blob/64acfe27f40ab6b99ba50a18615e94325714d2f3/radicale/storage/multifilesystem/cache.py#L84

It seems feasible to allow a custom cache location by modifying or extending the code. Would this approach work, and is it possible to provide a custom cache location for Radicale?

pbiering commented 5 days ago

I would assume it would be possible to store the cache directory outside of the collection-root in a parallel structure e.g. named collection-cache

/var/lib/radicale/collections/collection-root -> containing all the data
/var/lib/radicale/collections/collection-cache -> same directory structure but only the .Radicale.cache subdirectories per folder

A new option would be required like cache_subfolder either as directory name or as boolean and use hardwired collection-cache as collection-root is also hardwired so far.

So the related path must be reassembled then and used.

Someone has to create a PR incl. test cases, I can then review.

pbiering commented 1 day ago

I will try to work on this as I have also IO issues on my personal instance which is redundant active-passive using glusterfs.

pbiering commented 1 day ago

please try upstream version now using new option

[storage]
 use_cache_subfolder_for_item = True

and mount "collection-cache" to a custom location, can be even tmpfs as long as system is not rebooting all the time...