Gregwar / ImageBundle

Image manipulation bundle for Symfony 2
MIT License
195 stars 50 forks source link

Loadbalancing issue #84

Open arosslau opened 9 years ago

arosslau commented 9 years ago

Hey,

I have the following setup: 1 Loadbalancer in front of 2 Webnodes.

When Web01 renders a twig-template containing {{ web_image(image_url).zoomCrop(485,180).jpeg(99) }} it now generates a cache file in the webfolder of Web01.

But what if the request to serve that image is handled by Web02? I don't have and don't want sticky sessions in my loadbalancer.

Actually, I want a hook (event) which I could use to spread that freshly generated cache-image to all Webnodes during that request-lifetime, when its beeing created.

Is there any way to do so, or didn't I find any 'cause its not there?

As workaround I have rsync running every minute to sync between all webnodes, but if theres a request between each sync, that cach-image could not be served. Moreover this causes that the browser chaches this state for that user.

Gregwar commented 9 years ago

Hello, There is no such thing yet in this bundle What about setting up a NFS filesystem for your servers?

arosslau commented 9 years ago

At this point its not possible for me.

robbanl commented 8 years ago

@arosslau I've been in the same situation. I used inotify to rsync a single file when changed/updated/create to several remotes (syncing them all was to slow). Anyhow, this won't solve your problem because when the file is generated by the template, inotify / rsync won't be quick enough to transfer the image to the other nodes before the request for the image arrives, and will still cause a 404-error. I guess you could warm the cache files and rsync them before being generated. But I'd still say NFS is the way to go.