Storage deduplication for file uploads

(#3888) Feature Open: Under consideration api infra performance self-hosting

Current problem

As it currently stands, every attachment uploaded on a Fluxer server is stored as-is, even if said attachments are the same thing (for example, when I send that silly cat gif from my saved media ten times in a row). Storing multiple copies of the same file wastes valuable storage space, which is not great for the mainline Fluxer and worse for self-hosted instances.

Proposed change

Make it so that Fluxer can detect when a file is uploaded multiple times, and link all occurrences of the said file to a single copy. Perhaps this can be done by comparing hashes - Fluxer should already be generating them to make sure the file is not banned from the admin panel.

Platform

API, Self-hosting

1 comment

Sign in with Fluxer to comment and vote.
Comment by sodiboo
Does Fluxer even need to do anything here? I feel like there are performance tradeoffs to this, and the S3 backing storage for media uploads is perfectly capable of implementing this on behalf of a Fluxer instance. as far as i can tell, SeaweedFS, which ships by default in the self-hosted compose recipes, does not in fact deduplicate files, but for example Garage does. It seems natural that an instance operator can choose an S3 implementation according to their needs.
when I send that silly cat gif from my saved media ten times in a row
it also feels natural to me that this should not cause a reupload, but just link to the same instance of the file each time. but that doesn't need global deduplication; this just needs the client not to reupload stuff unnecessarily.