ayon-backend
ayon-backend copied to clipboard
Optimize entity thumbnail storage
Story
Currently, entity thumbnails are stored directly in the database as blobs without any size reduction, which results in significant growth in database size. This approach is inefficient, particularly as the volume of data increases.
Proposed Solution
Adopt a similar methodology used for handling file attachments. Specifically:
- Implement a check during the thumbnail upload process to determine if the image size exceeds a predefined limit.
- If the image exceeds this limit, the thumbnail should be saved to the filesystem instead of the database.
- A scaled-down version of the thumbnail should be stored in the database to ensure quick loading and reduced space usage.
Open Questions
- What should be the size limit for thumbnails stored in the database?
- What scaling factor should be used for reducing the thumbnail size?
In order to maintain 100% backwards compatibility as well as consistency with project/files, scaled-down thumbnail should be accessible using ?preview=true
while the original size should load thumbnail directly from the filesystem (with DB as the fallback for older projects). A migration tool could be created to process thumbnails in existing projects.