Though it would be a nice feature (and we hope to eventually support some kind of auto-scaling like this for Machines), the app scheduler doesnât currently place instances based on an analysis of incoming traffic load. It simply places instances in any of your selected regions where there is sufficient capacity.
You can manually control instance placement by using the --max-per-region 1 argument to flyctl scale count to force your app to deploy only 1 instance per region.
Yes, Edge means you have incoming traffic from that region (itâs the region where our proxy first accepts the connection before routing the traffic to your nearest app instance).
So the behavior now is that I select the region pool and how many instances, and Fly just puts those instances randomly on regions? It could be 2 instances on one region while no instance in others. Or any logic behind how we place the instances?
Fly.io currently uses HashiCorp Nomad as its âapplication schedulerâ, the part of the system responsible for deciding where to place instances based on allocating server resources (such as cpu/memory). In this system, under the hood we create a job specification based on your Fly app config. This specification includes a couple hard âconstraintsâ, including your appâs selected regions and any âmax per regionâ setting if set. The Nomad scheduler will then place VMs on servers matching those constraints using a bin-packing algorithm, so the exact servers your VMs end up on will appear more or less ârandomâ to the application developer (because it depends on resources available on servers in selected regions at any given time).
If you need more low-level control over exact placement of instances, you can try using Machines which is a low-level VM provisioning API to launch individual instances in specific regions. Weâre building the next iteration of our application scheduler on top of Machines, and it should be easier for us support more advanced configuration and scaling features once that work is ready.