5
votes

I've moved an existing asp.net web-api over from an Azure VM (with IIS and MSSQL installed locally) to an Azure web app and Azure SQL database (both west-europe). I'm noticing a dramatic increase in processing duration between the two for the same workload. Tasks that take 10-15ms on the VM, take at least 150ms in the hosted service environment. Both internal processing, not including network latency to/from the vm or web app. Both with empty databases and the same code-base. Same database schema with the same indexing.

The VM was a simple 2-core/7GB SSD machine. But even when I set my web app to a premium 4-core/7GB and my database to a premium 250DTU, the performance does not increase at all. In fact, its the same on a basic 2-core web app and 10DTU database. So the bottleneck has to be somewhere else.

How would I go about finding out what causes the slow processing? The web app and database show no performance alerts and don't advise scaling up either.

2
When you say local do you mean your local machine or a machine that's on premise on the same network?univ
Any updates on this issue. Did you manage to address this?pnizzle

2 Answers

0
votes

Run the following query per session/workload to know what is the type of wait occurring during those workloads:

--your query here

go

select * 
from sys.dm_exec_session_wait_stats
where session_id = @@spid
order by wait_time_ms desc

The last SELECT statement will provide you all waits for current session.

You can also enable Query Store.

http://www.sqlcoffee.com/Azure_0010.htm

And run the following query to know what makes queries wait during execution

select  wait_category_desc, sum(total_query_wait_time_ms) as [sum ms], count(*) as [interval cnt],  avg(avg_query_wait_time_ms) as [avg ms], sum(total_query_wait_time_ms / avg_query_wait_time_ms) as [wait cnt]
from sys.query_store_wait_stats
group by wait_category_desc
order by [sum ms] desc

The following article will tell you the meaning of each wait category.

https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-query-store-wait-stats-transact-sql

Hope this helps.

0
votes

I faced the same issue today: Azure Web App with Azure DB resulted in slow performance on anything interacting with the DB.

However when I ran the app locally on my pc the experience was very fast. I therefore checked my app service and location. I was using S1 service located in the US with the database in Australia.

•I therefore upgraded to Premium S2 and

•Located my Web App and DB to be in the same region.

These two changes resulted in a massive performance increase.


Im not sure why having my previous answer be a duplicate is a problem if Im the original poster of the same answer on another question and and if the answer applies and is correct as is. It doesn't make sense to change it just because. Please comment first and allow me to edit before completely deleting...