Horizontal scaling breaks app: Works fine with one VM, becomes very buggy when scale count >1


I’m encountering a critical issue when I try scaling my apps horizontally to >1 VM: With more than one VM running, (most of) the UI renders but some things are strangely buggy. File upload and download buttons fail unpredictably, and data tables don’t render properly (failing with an error about AJAX). If I scale back down to one VM, the problems disappear.

I’ve created a new app with a minimal reprex that demonstrates the behaviour (“multivmtest”).

Is there any guidance on what to do? The app is a generally well-tested dockerized web app written using R Shiny. It works great on Fly with a single VM running, so I’m surprised that adding more VMs breaks it. My best (bad) guess is that user requests are being routed to available VMs randomly, so requests only work if they go to the “right” VM. But the docs say websockets are supposed to just work with Fly, so I don’t know why that would be.

Thanks for making Fly great–I’m having a lot of fun with it, and this is the first serious issue I’ve had. My app is a resource-hungry analytics application, so I’d like to be able to scale out to have more VMs for more concurrent users.