Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): disable sharp file caching #6542

Merged
merged 1 commit into from
Jan 21, 2024
Merged

Conversation

mertalev
Copy link
Contributor

@mertalev mertalev commented Jan 21, 2024

Description

sharp / libvips holds up to 20 files open as part of its operation cache by default (see here). This has a dramatic effect on RAM consumption, especially in the case of RAW files. There's normally a 50mb limit on the cache, so I'm not sure if this is expected behavior.

This change will most likely not have an effect on performance since we process each thumbnail of each asset at different times, so the original image will have been evicted from the cache by the time we generate another thumbnail for it.

Should fix #4391

How Has This Been Tested?

I uploaded a number of RAW images with and without this change multiple times, force deleting the images in-between each run so they were reprocessed. WIthout this change, the container's memory usage increased dramatically with each image, using several gigabytes of memory after a handful of images. With this change, there was still an increase, but the increase was on the order of a few hundred megabytes and stabilized.

Copy link
Contributor

@jrasm91 jrasm91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@mertalev mertalev merged commit 311261b into main Jan 21, 2024
24 of 25 checks passed
@mertalev mertalev deleted the fix/server-sharp-cache branch January 21, 2024 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] magick-files filling /tmp on microservices container
2 participants