Azure Web API通话在手机上速度较慢,但​​在Android模拟器上效果很好 [英] Azure web api call slow on phone but works well on android emulator

查看:99
本文介绍了Azure Web API通话在手机上速度较慢,但​​在Android模拟器上效果很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Xamarin Forms应用程序中使用Refit调用我的Web api,它似乎在模拟器中运行良好(2-5秒),但在真正的android手机上大多数时候崩溃,或者花费了相当长的时间在极少数情况下返回.我在Azure上使用基本的5 DTU SQL数据库.这可能是原因

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

我尝试从该设备拨打2个电话,并且上图中的峰值是它的结果.第一个查询需要一些时间,一旦返回(我设法得到了答复),我进行了第二次调用,该调用在返回后也返回 延迟.我是否需要使用所有索引.

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..??

推荐答案

我在Azure上使用基本的5 DTU SQL数据库.这可能是原因

I am using a basic 5 DTU SQL database on Azure. Could this be the reason

是-完全有可能通过更改数据库层来解决您的问题;该图显示您的查询达到了该5DTU限制的大部分.如果查询很复杂或数据集很大,那么使用S层数据库可能会获得更好的性能. (尝试使用S0或S1并检查性能是否更好.)

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..??

根据正在运行的查询的类型,索引可能会对数据库的性能产生有益的影响. (您绝对应该研究是否可以通过这种方式优化性能.)您可能对Azure SQL数据库的某些功能感兴趣,这些功能可以帮助您检查(并提高)查询性能- SQL查询存储.

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.

这篇关于Azure Web API通话在手机上速度较慢,但​​在Android模拟器上效果很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆