How long are VMs kept alive?

I’ve just learned about Fly and find it to be an interesting service. As best I can tell, the primary selling point is that an app can automatically scale and move between regions so it is always running close to its users. I can see why this is awesome for stateless services, but it has me wondering about stateful apps that primarily keep data in memory (ie. Elixir). To that end, I have a few questions:

Question 1: Is this an obviously bad use case for Fly? I’m sure there are work arounds like sending data to Redis or disk on shutdown, but it’s always best to not need such work arounds in my opinion.

For the sake of discussion, let’s assume:

  • I have a perfect app, it never crashes, never runs out of memory, and would never shutdown or restart due to its own fault.
  • The app has one instance, is configured only in a single region, and has no autoscaling (min=1 max=1).

Question 2: How long should the VM stay running? Are we talking minutes, hours, days, or indefinitely? Is it ever shut down due to low traffic?

Question 3: Now let’s assume the same app is configured with two possible regions, but still a maximum of one instance. Is it safe to assume that Fly might shutdown the VM at any time and move it to another region depending on where requests are coming from?

Thank you for any insight you can share.

Howdy! No that’s a good use case for Fly! By default, app VMs run forever, barring hardware issues. This is true even if you have 2 regions, we don’t automatically migrate VMs by default.

Enabling autoscaling changes this behavior. In “standard” mode, we add/remove VMs as traffic changes.

With “balanced” mode, we will update the region layout every hour. This will cause your VMs to shut down up to once per hour.

Does that make sense?

1 Like

Hi Kurt,

Thanks for clarifying everything for me. It sounds like Fly and Elixir would definitely compliment each other. Perhaps it’s time for me to migrate some simple projects away from Heroku.