Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure App Service slow compared to Azure VM

I have an ASP.NET Core system (based on NopCommerce framework) hosted on Azure VM (Standard F8s_v2 size). The application runs pretty smooth. Average response times are around 200 ms which is acceptable. Very same application was hosted on Azure App service (P2v2 plan). It is noticeably slower. Average response time is around 500 ms.

I did tons of monitoring profiling:

  • CPU on both Azure App service and VM is low. A single request gets CPU at around 5% on App service and around 3% on VM.
  • Upgrading App Service plan has zero effect.
  • There are no memory usage spikes neither on VM nor on App service
  • IO is close to non-existent on both VM and App service.
  • Both VM and App service got their own databases. Both of them were swapped when trying to figure out details of this behavior. No difference in behavior.
  • All resources are on hosted on the same region.

Nothing really suggest this being a resource related performance issue on App service.

I got this profiler trace when profiling App service: App service profiling

The application has built in profiling, implemented with MiniProfiler. The comparison of calls to identical endpoints on VM and AppService can be found here: VM vs App service profiling

What could be causing this slowdown on App Service? What else is worth checking that would provide any hints on why response times are different?

like image 864
Povilas Vytautas Jeremičius Avatar asked Sep 23 '19 11:09

Povilas Vytautas Jeremičius


People also ask

How is app service different from virtual machine service of Azure?

Azure VMs offer developer more control over the environment. Like, one can't choose underlying OS of VM in an Azure App Service. Azure App Services do not offer Pay-as-you-Go. Hence, you're paying for the service plan, even if you're not using it.

Does Azure App Service use VM?

If multiple apps are in the same App Service plan, they all share the same VM instances. If you have multiple deployment slots for an app, all deployment slots also run on the same VM instances. If you enable diagnostic logs, perform backups, or run WebJobs, they also use CPU cycles and memory on these VM instances.

Why is my Azure VM so slow?

If you are using shared storage services such as Azure Files it also means that you need to understand the performance is linked to the size of the share. So, if you have applications or other services that are dependent on a shared folder, and you haven't properly sized the share you will get crappy performance.


1 Answers

The actual problem of this the way application as hosted. Project settings would use outdated AspNetCoreModule as well as hosting model. Forcing it to use ASP.NET Core 2.2 new inProcess hosting model resolved the issue. If you are interested in more intricate details of why it runs faster you could read this

like image 114
Povilas Vytautas Jeremičius Avatar answered Sep 18 '22 04:09

Povilas Vytautas Jeremičius