App Service Plan with high CPU without load - azure

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.

Related

HandlerChanged to (httpPlatformHandlerMain) issue in Azure

I was running a web app service and all of a sudden I see a degraded performance in the response time. I did not do code changes but I get the followin warning:
We analyzed 15 slow request(s) and identified module(s) consuming most of the time are - HandlerChanged to (httpPlatformHandlerMain)(95.83%)
I did not explicitly change any configuration on Azure so thats why I am suprised to see such degraded service.
I redeployed the same code and restarted the webapp
There might be several reasons for degraded performance in your Azure Web App Service, such as increased traffic, changes in modifying infrastructure.
Follow the below steps to troubleshoot Azure Web App Performance issue.
Check the resource utilization: Kindly check the Azure Web App utilization such as CPU, Memory, and Disk Space.
If your Web App utilization is high, you may need to scale up your App Service plan, Like below.
Check the Web Application logs: Kindly check if any error messages in the logs that could indicate the cause of the issue. You can check the logs in the Azure portal by navigating to below options.
Azure Portal > Select your App Service > Log stream
Monitor your app performance: Monitor the performance of your Azure Web App by sending Apps Logs to Log Analytics workspace to get a better understanding of the App performance degradation issues,
Azure Portal > Select your App Service > Diagnostic settings > Add diagnostic setting
You can check for recent changes in your application., such as changes to the code & configuration, to see if they are causing any performance issues in your application.
Restart the App Service: Sometimes you can resolve the Azure App performance issues by restarting the application.
Azure Portal > App Service > Select your application > Overview > Restart
For more information refer : Troubleshoot slow app performance issues in Azure App Service

Migrate Windows Service to Azure

We are migrating to Azure. We have a Web App deployed. However, I have a Windows Service that I need to add in to the mix. The service continuously runs, checking the associated Service Bus Queue for messages every 5 seconds.
I am looking for recommendations on how to do this.
I have looked at Web Jobs. But, I don't understand how it gets kicked off. I know there is a Web Hook involved - but I just want the code to run continuously without having to be constantly kicked.
We are also trying to avoid the cost of having a VM involved.
Thanks in advance.
Since you already have a web app, you could use a Azure App Service to run the Web App. The Azure App Service will allow you to also have a Web Job that you can have run on a schedule.
It does not make sense to break you web app into Azure Functions since it is already built. You can have the service run in an Azure Function, but it will probably add more complexity to interact with the web app (if that is what is happening) and if the service is running every 5 seconds, that could get costly.

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.

Does Azure Webjob stop when Azure App Service is stopped

In our current setup there are 2 slots for an Azure App service, the question that I have is, when the slot is stopped would it also shut down the webjob that is deployed on that slot or would the web job continue to run?
It is possible to run an Azure WebJob even when the Azure App Service Web App is not running.
Though you can force the WebJob not to run or stop when the Web App is running using WEBJOBS_STOPPED setting in your Web App's "Application Settings"
Take a look at this article about this subject for more details:
https://blogs.msdn.microsoft.com/benjaminperkins/2017/03/01/failed-to-run-webjob/
The following picture shows a running WebJob when the web app is not running:
https://github.com/projectkudu/kudu/wiki/Full-stopping-a-Web-App
I have actually deleted some running jobs, but even though my jobs were shown as deleted in the UI, they are silently running and consuming the memory. I observed this from availability and Performance > Memory Analysis dashboard under Memory Drill Down > Memory Usage (App) > Physical Memory Usage section. Shocked to see the jobs still running after they are deleted. Luckily this solution helped me kill all the processes.

Azure environment respond very late for few seconds after deployment

When the MVC application is deployed to azure environment, there is slowness in page loading and also response time of web site get delayed for few seconds once the deployment is done.
When the application is deployed in production environment, this slowness make the bad user experience.
Automation test scripts fails due to delay in response of site immediate after deployment
Deployment is done from Visual studio 2013 to Azure Web App services using Visual Studio Publish option settings.
What we have tried:
Deployment is scheduled once in 30 days and also in mid night, however the user in other part of world face issues when deployment happens.
Can some one help me to resolve issue and there should not be any difference to user when deployment happens in production.
There is a slight increase in loading time, for the first request, after an application is deployed to an Azure Web App. What happens behind the scenes is that the underlying web application must pre-compile the MSIL into machine code before it can serve the site. See https://msdn.microsoft.com/en-us/library/ms366723.aspx for more details.
The application pool, used by the Web App, is also regularly recycled in case of in-activity. The same pre-compilation happens then as well. This downtime can be minimized by enabling "Always-On" for the Web App. See https://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/ for more details on how to enable it. The always-on feature regularly pings the site to keep it from going inactive.
Also, to minimize downtime, when doing a deployment to a Azure Web App. Have a look at using deployment slots, https://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/. Idea here is that you first deploy to the deployment slot (an own web app instead, get it warmed up) and swap it to be the production slot. This way achieving minimal downtime for the Web App. To automatize this process there is a feature called Auto Swap https://azure.microsoft.com/en-us/documentation/articles/web-sites-staged-publishing/#configure-auto-swap-for-your-web-app that does this for you.
Deployment slots are available for standard and premium apps while always-on is available for basic, standard and premium apps.

Resources