Pixboost / transformimgs

Open source image CDN.
https://hub.docker.com/r/pixboost/transformimgs
MIT License
226 stars 12 forks source link

Cache input and result image? #39

Closed HolgerHuo closed 1 year ago

HolgerHuo commented 1 year ago

Is there currently a plan to support cache storage for input/output images to reduce processing time? We can save produced AVIF/Webp or other optimized/filtered images in a local storage for future use when client sends same/similar requirements. Or is this done in the proxy/CDN layer?

dooman87 commented 1 year ago

Hi there,

Thanks for openning an issue and it's something I was thinking a lot.

Currently, in SaaS version we have CDN as a first layer of caching but also, there is a second level on GCS bucket. The way we are doing it at the moment is using transformimgs as a library and adding middleware that does caching. This works well with the central bucket given we run a lot of instances in the cluster configuration that still share the second level cache.

We were thinking about open-sourcing second level cache but didn't want to tie the implementation to the specific Cloud Provider.

One of the solutions I can think of is to to use local filesystem and if needed we can mount Cloud Storages using Fuse. There are implementations for GCP, AWS, and Azure so that would still allow to deploy transformimgs onto the big clouds.

The other way to approach it could be to add cache to the web server. For instance, we can use distributed Caddy cache handler in the quickstart/ to have it out of the box.

Would any of the above cover your use case?

HolgerHuo commented 1 year ago

Hi! Thank you for your quick response! I'm currently using Nginx as proxy layer caching, by client header(accept) and request URI as caching key, and it is covering my use case now. Thank you for your suggestion! As for the first approach you'd suggested, if I might have any ideas about it, I'll contribute it back to the project. Thank you for your efforts in creating the project!