I’m running into an issue with autoscaling on my app (running apps v1 still). I’m receiving this warning and I’m confusing about why it wouldn’t be already scaling my resources?
[warn] Instance <> reached hard limit of 200 concurrent connections. This usually indicates your app is not closing connections properly or is not closing them fast enough for the traffic levels it is handling. Scaling resources, number of instances or increasing your hard limit might help.
My application is a websocket app so it’s got long-running connections but the number of instances that are running are below the max count that I have set. I thought that Apps was supposed to handle scaling based on the connection limit that I set? I’ve also got multiple regions set up, am I just going to get this warning until the connections drop and in the meantime the traffic will be directed to another region?
I can increase the hard_limit but isn’t this limit how Nomad determines adding new instances? Why wouldn’t it be doing this? The docs mention this on hard limits:
For Nomad apps only, the system will bring up another instance if the autoscaling policy supports doing so.
I doubled checked the policy on my app and autoscaling is enabled.
Edit: Guess the docs answered my own question about why it may not scale out:
Autoscaling is a horizontal scaling service based on a global pool of instances where the application can be run. The system will create at least the minimum number of application instances. The autoscaler will then create instances (scale-out) as total application load exceeds the soft_limit * [instance count] threshold, up to the max count. It will also remove instances (scale-in) when the max application load over a 10-minute window dips below the same threshold, down to the min count. The 10-minute scale-in window allows for rapid scale-out with slightly more relaxed scale-in.
The Apps v2 “autoscaling” is a lot more sane here. It’s not quite autoscaling the same as Apps v1 autoscaling is - we won’t create new instances (named Machines in apps v2) - but if you create as many machines as you think you’ll need, and set them to automatically start/stop, we’ll start an additional instance right in the HTTP service handler when the currently running instances are at capacity. Here’s the docs for this: Automatically Stop and Start Machines · Fly Docs