Azure autoscale on app service does not scale back DOWN on schedule - azure

I have an Azure AppServicePlan and have enabled Autoscale based on a schedule. The default number of servers is always 1.
During weekdays it should scale up at 12:50pm to 2. Then at 4pm it should scale back DOWN to 1.
It always scales up correctly, but does not scale down at 4pm. It remains on 2 servers. Today it scaled up correctly from 1 to 2 servers at 12:50. However it is now 16:50 and it has remained on 2 servers. It has NOT scaled back down to 1 at the END time of the rule.
The default scale rule is not executing as my CPU is never more than 10% and memory is never more than 58% or so.
This is how my configuration looks:

Related

Is it a recommended practice to scale down the AKS usernodepools to 0 dring non work hours?

We are using AKS 1.19.1 in our sandbox environment and have both system and user nodepools seperately. We have multiple applications running in our user nodepools along with istio as service mesh. Current node count of the usernodepool is 24 and auto scaling is enabled.
Now as part of cost optimisation, we are planning to scale down the usernodepool to zero during the non working hours ( say after office time or during night time).
Reference:- https://learn.microsoft.com/en-us/azure/aks/scale-cluster
Will this be recommended way to do scale down to zero nodes for such a cluster with nodepool size of 25 nodes
if yes,
When we renable autoscaling property (everyday after making the count to zero at night) , will this automatically increase node count and application pods will be auto sterted or, we need to rollout the restart of the pods seperately?
What are the factors it depends to back the normal running state and how long it may take?
Is there any way to schedule this feature of scaling down to zero during night and then again renable autoscaling property at morning automatically
Just use KEDA and let it manage the scale up / down for you:
https://learn.microsoft.com/en-us/learn/modules/aks-app-scale-keda/

Virtual Machine Scale set in Azure doesn't scale

Virtual Machine scale set in Azure doesn't scale. The CPU usage on the VM is 99%, but the utilziation shown on Azure for only one is around 10%-20%.
I have tried adjusting the scale lower for the average cpu to 40%, but it doesn't change anything.
When the virtual machine starts, there is a load of around %80-90 instantly from my code. The scale set should scale to a second machine after 5 minutes and keep repeating until the load decreases and all runs are complete. What happens the machine starts and if you RDP to the machine, task manager shows the process using 80-90% cpu constantly. If you view Azure to see the scale set as a whole it only list 10-20% cpu usage. The virtual machine is a server 2016 core edition built-in to Azure. It is almost like it isn't reporting back to azure the CPU usage, so it never scales beyond 1 maybe 2 every once in a while.

Azure cloud service auto scaling through classic portal

We have a IaaS cloud service, trying to auto-scale. Weird is, we didn't see the scale happen, we configure the auto-scale based on CPU metric, range is 20-60, looking at logs of one of active server, its CPU is 40%, but seems there is no extra instance got booted up and added to the farm.
Looking at Microsoft documentation, it says 'based on the average percentage of CPU resources that it uses.', what does this average meant, daily average, hourly average or (ideally under our impression) the time duration (the scale up wait time) since the farm's last scale.
All instances are included when calculating the average percentage of CPU usage and the average is based on use over the previous hour.
https://azure.microsoft.com/en-us/documentation/articles/cloud-services-how-to-scale/#automatically-scale-an-application-running-web-roles-worker-roles-or-virtual-machines

How long does it take for Azure Websites to Autoscale?

I am using MVC3, ASP.NET4.5, C#, Razor, EF6.1, SQL Azure
I have been doing some load testing using JMeter, and I have found some surprising results.
I have a test of 30 concurrent users, ramping up over 10 secs. The test plan is fairly simple:
1) Login
2) Navigate to page
3) Do query
4) Navigate back
5) Logout.
I am using "small" "standard" instances.
I have found that when my Azure setup is configured to "autoscale", it behaves like my test with one "small" instance with no autoscale. When I setup two "small" instances with no autoscale, it goes twice as fast, or rather the average process time per request is 2x, over the test. So it appears that it is NOT autoscaling. I have tried setting the CPU trigger to a lower target ie 40-70. Still no joy.
On further investigation, when "Autoscale" was first introduced, it seems it evaluated the metrics over the previous hour, and now I see references to "10 minutes". I thought that once the CPU started hitting the target value, then it immediately triggered the new instance, which must be the whole point of "autoscale". If I have a burst of concurrent usage, I need the extra instances now, hence a reason for using a PAAS . Since my test took less than 10 minutes, "Autoscale" never kicked in. So what should be the time that Autoscale takes to kick in?
Thanks.
Azure will check the CPU metric every 5 minutes, and if it exceeds the threshold that is set, will increase the instance count at that point.
Interestingly, Azure will decrease instance counts after 2 hours of remaining below the threshold.
Source: How to Scale Websites
Quoted relevant section:
Note: When Scale by Metric is enabled, Microsoft Azure checks the CPU
of your website once every five minutes and adds instances as needed
at that point in time. If CPU usage is low, Microsoft Azure will
remove instances once every two hours to ensure that your website
remains performant. Generally, putting the minimum instance count at 1
is appropriate. However, if you have sudden usage spikes on your
website, be sure that you have a sufficient minimum number of
instances to handle the load. For example, if you have a sudden spike
of traffic during the 5 minute interval before Microsoft Azure checks
your CPU usage, your site might not be responsive during that time. If
you expect sudden, large amounts of traffic, set the minimum instance
count higher to anticipate these bursts.
It is now possible in the new Azure portal (https://portal.azure.com) to configure scaling based upon different metrics:
CPU
Memory usage
Data in/out
Http queue length
Disk Queue length
And also to configure scale up time and scale down time. In the graph it will show you the current amount of instances (solid line) vs your max configured (dashed line) and your configured metrics. When the metric exceeds the line (=configured scale up for that given metric) it will scale up & vica versa.

Azure VMs unexpected shutdown while AutoScaling

Today we had an issue with Azure VMs where one VM in availability set of 2 just stopped responding. After few mins we noticed that machine was shutdown and the other VM in the set wasn't turned on (which should be ok as this isn't a failover). We have take a look at the VM monitoring and there wasn't a single log telling us that there was any downtime. The only thing that we found is 2 strange logs in the Management Services - Operation Logs.
11/12/2013 10:12:02 PM AutoscaleAction Succeeded VirtualMachinesAvailabilitySet:xyz Autoscale
11/12/2013 9:36:56 PM AutoscaleAction Succeeded VirtualMachinesAvailabilitySet:xyz Autoscale
The first one was with following details:
Description: The autoscale engine attempting to scale resource
'xyz' from 0 instances count to 1 instances count.
LastScaleActionTime: 20131106T173020Z
NewInstancesCount: 1
OldInstancesCount: 0
Second one:
The autoscale engine attempting to scale resource 'xyz' from 2
instances count to 1 instances count.
LastScaleActionTime: 20131112T203656Z
NewInstancesCount: 1
OldInstancesCount: 2
Does anyone know what may had happen ?
UPDATE
Azure Support has provided me with the feedback and they explained that machines were down due to host update.
Regards
Whenever you use autoscale you set an instance range that tells Azure the minimum and maximum number of VM's you want to be running at a given point in time. In this case, it looks like you've set the minimum to be 1. That would explain why, when both VM's were stopped, it turned on one of them.
In addition, the scale from 2 to 1 was likely because load was low on your VM's (assuming you're scaling by CPU). If the average CPU remains below the target you've established (by default 60%), it will scale down until it hits the minimum (in this case, 1).
Both of my machines were down because of the host update and AutoScaling set from 1 to 2 machines based on CPU usage. So I have found out that AutoScaling won't turn the second machine on when doing host update (which can be pretty helpful and make my apps online).
I think that will explain the 0 of 1 instances issue, so don't use AutoScaling with above setup to get HA.
Regards

Resources