How can I manually unload an Azure App Service? - azure

I've got a React frontend using a NodeJS backend application running as an App Service in Azure. And I'm troubleshooting that it doesn't work properly to wake up / load the backend application after it has been unloaded due to inactivity.
According to this GitHub issue, the App Service is not unloaded before 20 minutes of inactivity.
Since it would be very ineffective to have to wait 20 minutes for the app to be unloaded over and over while troubleshooting my problem, I would like to manually trigger the App Service to be unloaded. Either using the CLI, an API, a menu option in Azure or something else.
How can I manually trigger Azure to unload an App Service?

When you kill w3wp.exe, I think this is the same function as clicking the recovery on the iis physical server. The process is killed and a new w3wp.exe process will be regenerated when the website is revisited, which can be distinguished by pid.
Tips:
It's just that the test effect is similar, not that the recycle on iis is also a kill process to achieve this function.
Step 1. Open SCM site.
Step 2. Click Process explorer.
Step 3. Right click w3wp.exe, not scm.
Step 4. Then click Kill.
Show test results:

Related

Will Azure App service restart restarts the web jobs too?

I am just wondering whether Azure web jobs are restarted when I restart my app service?
When you hit the restart in azure portal, both the web app and web jobs get restarted. You can take a look at the official doc here:
Note that when you hit Restart, both the main and SCM sites get restarted.
The SCM site is where Kudu runs, including WebJobs.
You should also keep in mind that when you click Stop in the azure portal, only the main site is stopped, while the SCM site(where web jobs running) keeps running.
Yes, if we restart the webapp, the webjob would also get restarted.
If you go to Kudu console of the webapp (webappname.scm.azurewebsites.net) and click on Process Explorer you will notice that the webjob is running under the w3wp.exe_scm which is the w3wp process for the kudu site. Also, the site is running under w3wp.exe.
If you restart the webapp, process ID for both the w3wp.exe would change.

App Service Plan with high CPU without load

We have an App Service Plan in Azure (PremiumV2: 1 Medium) with 14 App Services setup, but they are all stopped.
So without any load (that I know of), our CPU sometimes spikes to 100%. Is this normal? How can I find out what is causing the spikes? I'm guessing it isn't one of the App Services, since they are all stopped.
Generally, we click stop botton in the panel of Azure portal to stop an app service, but it only stop the main site you deployed under wwwroot, not the SCM site where Kudu & WebJob runs.
There is an offical document of Kudu wiki Full stopping a Web App which may explain your current case. When you deployed some WebJobs running in your App Services, they will not be stoped by clicking the stop operation in Azure portal. And it seems to be some continous WebJob running which cause the CPU & Memory consuming.
If you want to stop all of them thoroughly, please follow the wiki above to know how to do. Hope it helps.

Is it possible to perform configuration changes to an Azure Web App without the application restarting?

Currently when pushing updates via our CI/CD pipeline to the Azure Web Apps the nodes are being forcefully rebooted by azure once the configuration changes are completed.
Has anyone come across a way where you can apply a configuration (web.config or other) changes to the web app in a single slot configuration with out the forced restart?
As Fabrizio Accatino said, when you touch the web.config, IIS automatically restarts the app domain.
If you do this to avoid downtime, you could add a deployment slot and publish your newest project to it. When you want to publish your project to production environment,you can swap them.For more details, refer to this article.
If downtime is your concern, it looks like MS starts up another container when you hit Save in the application settings blade, and then transfers all new requests over to the new container. The old container is given 2 min to complete all requests, and is then shut down.
https://social.msdn.microsoft.com/Forums/azure/en-US/f15b207b-c063-46e5-b87a-2b157641c8c4/does-changing-an-app-setting-and-saving-restart-the-app?forum=windowsazurewebsitespreview
I tested this on a Web App by repeatedly hitting an endpoint for 30 seconds while I changed an application setting and hit save. I saw the application start, but did not see any timeouts, only 200 OKs.
FYI my web app only used a single slot.

Will auto heal kill a web job in process?

We recently implemented Auto Heal on our Azure account. It restarts itself every once in a while, maybe once per day.
We also noticed that some of our long-running cron jobs (web jobs) were not finishing.
Would an Auto Heal restart also kill any running web jobs? Could that explain why the crons are sometimes failing to finish?
There are two main processes for an Azure web app. There is the w3wp.exe process, which runs the website itself. The second main process is the w3wp.exe scm process, which runs KUDU.
All webjobs run on the w3wp.exe scm process (KUDU). Auto heal only restarts the site w3wp.exe process meaning your web jobs should not be impacted by auto heal. The exception here is that if you web job is pulling data from the main site when the site is recycling, this could cause your web job to fail due to the site being offline for the recycle.
You can observe your site processes by navigating to (replace sitename with your web app name) https://sitename.scm.azurewebsites.net/ProcessExplorer/
One item that you should ensure for long running web jobs is that you have 'always on' enabled. You can turn this feature on in the 'Application settings' blade for your web app.
You can also refer the link Proactive Auto Heal to know more about this feature.

Stopping an Azure Service does *not* stop the WebJob's continuously running behind it

I have an Azure WebJob that is running on a pretty simple App Service Standard: 1 Small (plan).
Now, there was a problem with my WebJob (which has 5 functions running) - I wanted to stop 4 of the 5 running functions. I couldn't see how, so I thought I'd just stop the entire WebJob instead.
So I ended up just stopping the App Service.
Great, that was stopped, but the WebJob was still running and I didn't notice that until a few hours later.
I later noticed that the WebJob blade has its own Start/Stop button.
I thought the WebJobs were tied directly to the App Service.
What is the connection between the two? How does one affect that other?
As far as I know, the web app and web jobs has different process in the azure.
You could find the Process explorer in the web portal as below:
So the stop in the web app will just closed the app's process(6584 as the image shows).
It will not stop the webjob's process(4648).
These two processes has no connection.
If you want to stop both web app process and webjobs process, I suggest you could try to use this way Full stopping a Web App.

Resources