-
Notifications
You must be signed in to change notification settings - Fork 15
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
Cache Expiry and Persistence for "load_image_async" Function #36
Comments
load_image_async
Function
load_image_async
Function
Are you closing the editor after generating images ? |
Yes, I am closing the editor after modifying the image. But my question is, why is the cache TTL set to 12 hours? I used easy_pil with FastAPI, which handles 22,000 images every day, but the API's RAM usage reached 7 GB in a single day. I think the load_image_async function is caching images for too long, which is causing the high RAM usage. |
So, do you think removing cache is better so you can implement your own caching strategy? editor = Editor()
img = await load_image_async(url)
editor.paste(img, ...)
img.close()
bytes = editor.image_bytes
editor.close() Let me know if this strategy helps reducing ram usage, ultimately all the images that you open must be closed to improve performance |
Yes, remove the cache strategy and allow people to implement their own. Otherwise, many users won't see the source code and will start using it in production. Later, they may complain about memory leaks. Alternatively, you could implement an LFU-based caching system that caches up to a set limit. |
ok I have removed the caching in version 0.4.0 |
Does this will not increase memory usage of the application in which easy_pil is used ?
I have an api which builds musiccard every second and I noticed my vps memory usage touched 1gb in just few minutes
The text was updated successfully, but these errors were encountered: