title: Azure App Service slow compared to Azure VM
body: <p>I have an ASP.NET Core system (based on NopCommerce framework) hosted on Azure VM (<strong>Standard F8s_v2</strong> 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 (<strong>P2v2</strong> plan). It is noticeably slower. Average response time is around 500 ms. </p>
  
  <p>I did tons of monitoring profiling:</p>
  
  <ul>
  <li>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.</li>
  <li>Upgrading App Service plan has zero effect.</li>
  <li>There are no memory usage spikes neither on VM nor on App service</li>
  <li>IO is close to non-existent on both VM and App service.</li>
  <li>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.</li>
  <li>All resources are on hosted on the same region.</li>
  </ul>
  
  <p>Nothing really suggest this being a resource related performance issue on App service.</p>
  
  <p>I got this profiler trace when profiling App service:
  <a href="https://i.stack.imgur.com/gsFfM.jpg" rel="noreferrer">App service profiling</a></p>
  
  <p>The application has built in profiling, implemented with MiniProfiler. The comparison of calls to identical endpoints on VM and AppService can be found here: <a href="https://i.stack.imgur.com/N0Jwn.jpg" rel="noreferrer">VM vs App service profiling</a></p>
  
  <p>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?</p>