Bypass "Dynamic image manipulation"


(Priit Pärna) #1

Dynamically resize uploaded images whenever you need to. PushType allows you to implement responsive images and advanced creative art direction techniques.

Is it possible to bypass Dragonfly etc for assets? We are currently using Dragonfly + Google Storage solution and it leaks memory like mad… and we need to move to something more bullet proof. Out kubernetes instances are restarting all the time because of that dynamic work needs to done for images served on the web fills up the memory cap and gets killed down.

All the best,
Priit


(Aaron Russell) #2

Hi @chemic

The easiest way to bypass Dragonfly is to use a CDN like cloudfront (or googles CDN). Just adding an asset_host to the your Rails config will tell PushType to prefix all media_path URLs with the CDN domain. I host a few sites on Heroku and this solves the memory problem most of the time. However, sometimes for higher traffic sites that’s not enough.

It’s worth reading the Dragonfly pages on performance/caching - especially the last bit about on the fly processing AND serving remotely. It gives a method for processing the attachments once, saving it to the data store, and then every subsequent request comes from the data store. I havn’t tried this, I’m not sure if it would be more or less effective that just using a CDN.

If you wanted to completely bypass Dragonfly and not use any kind of on the fly image processing, even once, then I’m not sure that’s possible. Long term PushType should replace Dragonfly with ActiveStorage gives us all the same functionality in a native Rails way, but I haven’t begun exploring how feasible that it yes.