简体   繁体   English

Windows Azure移动服务在Android中的首次连接

[英]Windows Azure Mobile Services first connection in Android

my application based windows azure mobil services. 我的应用程序基于Windows Azure Mobil服务。 Application connecting time is well normally but when login to application first time azure mobile services connection is very slow like 10 second, after connection speed is normally. 应用程序连接时间正常,但是在首次登录应用程序时,连接速度正常后,天蓝色的移动服务连接非常慢,大约10秒。 how can i solve this problem? 我怎么解决这个问题?

my codes; 我的密码;

private MobileServiceClient mClient;

private MobileServiceTable<products> mProductsTable;


mClient = new MobileServiceClient(
                          "https://example.azure-mobile.net/",
                          "aaaaaaaaaaaaaaaaaaaaaaaa",
                          this).withFilter(new ProgressFilter());;

mProductsTable = mClient.getTable(products.class); 

mProductsTable.where()
             .execute(new TableQueryCallback<products>() {
                   public void onCompleted(List<products> result, 
                                           int count, 
                                           Exception exception,
                                           ServiceFilterResponse response) {
           if (exception == null) {
}  else{
               Toast.makeText(Product.this, "Ops!!! Error.", 1000).show();
           }}
        });

If your mobile service is in the free tier, then when it's not being accessed it may get unloaded from memory and stored in disk. 如果您的移动服务位于免费层,则当不访问它时,它可能会从内存中卸载并存储在磁盘中。 At that point, when a request arrives at the service, it first needs to be "rehydrated" into a running process to serve the request. 在这一点上,当请求到达服务时,首先需要将其“重新水化”为正在运行的进程以服务该请求。 This takes usually 10-15 seconds, which is likely the delay you're seeing. 这通常需要10-15秒,这很可能是你看到的延迟。 After that, once the service is running, subsequent requests will be responded a lot quicker (since the mobile service process is up and running). 此后,服务运行后,后续请求将更快地响应(因为移动服务进程已启动并正在运行)。

Notice that if you scale your service to one of the paid tiers (basic or standard) this won't happen anymore: the service will be up and running the whole time, with the exception of times when you make changes to your service (redeployments, updating scripts, changing app settings, etc.), at which time the service instance may be recycled as well. 请注意,如果你扩展你的服务付费层的一个(基本或标准),这不会再发生了:该服务将启动和运行的整个时间,随着时代的异常,当你改变你的服务(调动,更新脚本,更改应用程序设置等),这时也可以回收服务实例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM