ImageBundle icon indicating copy to clipboard operation
ImageBundle copied to clipboard

Loadbalancing issue

Open arosslau opened this issue 10 years ago • 3 comments

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.

arosslau avatar Oct 01 '15 18:10 arosslau

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

Gregwar avatar Oct 01 '15 21:10 Gregwar

At this point its not possible for me.

arosslau avatar Oct 16 '15 15:10 arosslau

@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.

robbanl avatar Dec 29 '15 12:12 robbanl