Phoenix app hosted on, images are loading sometimes and sometimes not

Hi guys,

I have a small app hosted on, 2 machines and each machine has it’s own volume. User images which are stored on the volume are sometimes loading properly but not always. We’re talking about same images here. So, for example, user profile image sometimes load and sometimes it shows 404, when refreshing the page, sometimes it will load, but not always, it’s completely random. There are also no errors in the logs.

Do you have any idea what could be causing this?

Two machines for the same app, each with its own volume? Is the data the same on each volume?

If not, different requests could be getting handled by different machines, with access to different data in the volume. Images in volume A would be broken if the request was handled by machine B.

Yes, I started with a single machine with a volume attached and then scaled it to two machines so they should be completely identical.

That’s not quite how volumes work on Fly, as far as I know. There isn’t anything syncing data between the two volumes.

1 Like

I used only single instances for personal projects in the past, never scaled it so I can confirm I don’t know for sure how volumes work. I’ll check the docs. Thanks for the showing me where to look!

Yes, it looks like the problem is what you mentioned; data is not synced between volumes.

What would be the best way to handle this in your opinion?

This is one of the downsides of using Fly volumes.

I’ve dealt with this in other projects by moving file storage away from Fly volumes and onto S3. You might want to look at Tigris instead, it has Fly native support.

1 Like