I’m trying to vertically scale a service that is connected to an Azure AppGateway on a backend pool, running on a VM. When I add multiple instances of my service (e.g. two target VMs given by IPs), I think the load is randomly distributed between the two instances.
Since there is quite some caching in the service, I would prefer a deterministic routing. In particular, I want to route requests based on certain parameters that is in the request body.
The ideal would be something like this:
- load balancer checks
key_a
in the request body - some sort of hashing turns
key_a
into an integer (e.g. 428145), and take the modulo of the number with the number of VMs in the backend pool. - In case there is a single VM, modulo will always be 0, and request is always sent to the first (only) VM. In case there are more, the load balancer would distribute the calls deterministically between the available VMs.
Is this possible to do within AppGateway? Or I need to separate this routing from the AppGateway to an Azure Load Balancer?