问题
I am trying to make a call to my web api using Refit in a Xamarin Forms app and it seems to work well in the emulator (2 - 5 secs) but crashes most times on a real android phone or takes quite long to return on rare occasions. I am using a basic 5 DTU SQL database on Azure. Could this be the reason
I have tried to make 2 calls from the device and the spike in the chart above is a result of it. The first query takes a bit of time and once it returns (I managed to get a reply this time) I make a second call which returns too after a delay. Do I need to use indices at all..??
回答1:
I am using a basic 5 DTU SQL database on Azure. Could this be the reason
Yes- it is entirely possible that your issues will be resolved by changing your tier of Database; the graph shows that your query hits a lot of that 5DTU limit. If your query is complex or your dataset is sizable, you may get better performance out of an S-tier database. (Try an S0 or an S1 and check if you see better performance.)
Do I need to use indices at all..??
Depending on the type of queries you are running, an index may have a beneficial impact on the performance of your database. (You definitely ought to investigate whether you can optimize performance this way.) You might be interested in some of the features of Azure SQL Database that can help you examine (and improve) query performance-SQL Database Advisor &SQL Query Store.
来源:https://stackoverflow.com/questions/41643166/azure-web-api-call-slow-on-phone-but-works-well-on-android-emulator