Using Azure LoadBalancerProbe to automatically reboot failed instance - azure

Is it possible to use the cloud role (classic) LoadBalancerProbe with HTTPS Health probe to automatically restart a failed role instance?
I understand that this situation should be investigated, but if there's some spontaneous issue and all it needs is a reboot, and nobody is immediately aware of the issue (i.e. after hours or in a crisis), then it could resolve the situation.
Or at worst, can we tell it to move the existing connection to a health instance? Or will that happen when the user hits refresh on their browser?

Service Healing feature should help in this case. It is already provided service in Azure. For both web and worker roles, Azure injects a guest agent into the VM to monitor your role. This guest agent also performs a health check every 15 seconds of the role instance in the virtual machine. Again, if a predefined number of consecutive health check failures or a signal from the load balancer causes a role to become unhealthy and a recovery action to be initiated which is to restart the role instance.
Ref : https://azure.microsoft.com/en-us/blog/service-healing-auto-recovery-of-virtual-machines/

Related

How Azure Application Gateway's **cookie based affinity** works on VMSS downsizing

I was wondering how cookie-based affinity option in Application Gateway works while **downsizing **VMSS instance
I am having 2 VMSS instances with IIS installed & 10+ .NET applications,
I have setup a custom autoscale rule that if my CPU usage goes up by >70% for 5 mins if will spin up new instance(3rd instance) and route the traffic to the newly created one , but suddenly if the CPU percentage comes <50% then it will automatically delete newest instance that is created.
but what if one my request is still active on 3rd(newly created instance ). will my VM(3rd instance)wait for the request to complete or simply shutdown the instance?
Thanks.
Enabled Cookie-based affinity option
enter image description here
The 3rd instance will be removed, you will need to configure connection draining on your Azure Application Gateway HTTP settings for existing sessions to complete.

How do I set up healthprobe for a web application running on an Azure virtual machine?

State of the application:
A single virtual machine which runs an apache server.
Application exposed via the virtual machine's public IP (not behind a loadbalancer)
I have an healthprobe endpoint running that needs probed every few seconds to see if the app is up, and trigger an alert in case it is not.
What are my options? I want to get the healthprobe up and running first, before I move to a virtual machine scale set and a load balancer.
You need something like a watchdog that calls the health endpoint at a given interval. In Azure you can use an availability test. You can then create alerts based on this availability and optionally create dashboards that show the status over a given period.
As a bonus you might integrate the application insights resource in your web app to get detailed monitoring. See the docs
Under Support+troubleshooting -> Resource health of your virtual machine portal panel, you can set up a health alert.
You can then select under which conditions the alert should be triggered. In your case, Current resource status: Unavailable should work just fine. You can also implement a custom notification (E-Mail) under Actions or implement a logic that triggers an Azure Function or Logic App that performs an action when the VM is unavailable.
To detect if your application in Apache server is working correctly you can use a monitoring solution that checks the Apache error logs.

Azure cloud service: two web role instances rebooted at the same time?

I have a web site hosted on Azure as a cloud service. It has a web role with two instances. The instances belong to one resource group and are assigned to different update- and fault domains, which in theory should prevent them from simultaneous reboot.
Some time ago we experienced a ten minutes long downtime and it seems that our both web role instances were rebooted at the same time.
Azure management logs do not say anything relevant, the reboot logs are completely empty.
Is this actually possible that both instances were restarted at the same time?
Why do "Reboot Logs" contain no information?
How can I check what really happened (any other logs somewhere)?
How can I prevent both instances from being rebooted at the same time?

Warming up of Cloud Service Web Role deployments before VIP Swap

What is the correct way to way to warm up Cloud Service instances before performing a VIP Swap?
We're running two Web Role instances in our cloud service, and have already performed the following optimizations:
IIS 8.0 Application Initialization module in a Windows Azure Web Role
Controlling Application Pool Idle Timeouts in Windows Azure
Set AutoStart = true
Despite all these changes our site still takes around 10-20 seconds to start up after having performed a VIP Swap.
Is doing something like using a WebRole to hit the endpoints still the best way to go?

how does a client know where a WCF endpoint is when it calls a windows azure WCF service

for ex you have:
2 instances of a worker role, 2 instances of a web role.
the worker role calls a WCF service on the web role. If I have only one web role, it knows it's addressand all is fine. But if I have 2 web roles, how do they accomplish load ballance, how does the worker role know which instance of the web role to call to?
Load balancing in general works by having a separate piece of hardware that acts as the designated target for the service that is being balanced. As each new request arrives it is then simply forwarded to one of the actual target machines that provide this service implementation.
In your particular case the load balancer will be the single public endpoint for your web roles. DNS lookups or direct IP addressing will result in requests arriving at the load balancer machine and not directly to any of the web roles. The balancer then forwards the request to one of the two web role instances that are known by the load balancer.
One of the advantages of this approach is that you can quickly start new web role instances if you anticipate a spike in traffic. All Azure needs to do is inform the load balancer those new instances are available and they will immediately start accepting new requests. Likewise you can scale back the number of instances. Because the load balancer itself is not being restarted it means your service is not disrupted.
You can find more detailed information at...
Cisco Definition
Wikipedia
DevCentral
Windows Azure load balances Web Roles automatically, you don't have to do anything.
If you need to address specific web role instances, I would suggest you reconsider your architecture, specifically look at using shared state via the SQL Server session state provider, or look at the appfabric cache provider in the training kit labs.

Resources