简体   繁体   English

使用OData时,如何加速Restlet for Android?

[英]How can I speed up Restlet for Android when using OData?

I am attempting to use Restlet for Android to query an OData data source. 我试图使用Restlet for Android来查询OData数据源。 However, I am not impressed with its performance in both the emulator as well on a real device. 但是,我对它在仿真器和真实设备上的性能印象不深。 I have the requests made in a wrapper AsyncTask to make the UI responsive but it still takes over 1 minute to finally return the objects. 我有一个包装器AsyncTask的请求,以使UI响应,但它仍然需要超过1分钟才能最终返回对象。

I get plenty of these in the LogCat window: 我在LogCat窗口中获得了大量这些内容:

10-04 18:20:41.667: DEBUG/dalvikvm(278): GC freed 7872 objects / 523928 bytes in 279ms

What can I do to speed up the queries? 我该怎么做才能加快查询速度?

Check out odata4j - http://odata4j.org This is an alternative odata library for java, including an android-compatible client api. 查看odata4j - http://odata4j.org这是一个替代java的odata库,包括一个与android兼容的客户端api。

We just released a simple android client example in our 0.3 release. 我们在0.3版本中发布了一个简单的Android客户端示例。 This example demonstrates an efficient way of parsing/paging an arbitrary odata service. 此示例演示了解析/分页任意odata服务的有效方法。

Along with service driven paging (mentioned by Alex), we use the efficient xml pull parser implementation to parse the odata payload (we found heap activity/GCs to be the biggest perf bottleneck on android). 除了服务驱动的分页(由Alex提到),我们使用高效的xml pull解析器实现来解析odata有效负载(我们发现堆活动/ GC是android上最大的性能瓶颈)。

I know this doesn't help you with the perf of the RESTlet library... but: 我知道这对RESTlet库的性能没有帮助...但是:

One thing to consider is using something called Service Driven Paging . 要考虑的一件事是使用称为服务驱动的分页的东西。 Note this is distinct from $top and $skip (aka client driven paging), because the server pages even if the client doesn't ask for it. 请注意,这与$ top和$ skip(也称为客户端驱动的分页)不同,因为服务器页面即使客户端不要求它也是如此。

SDP is particularly useful when a client does an unfiltered query over a large data set. 当客户端对大型数据集执行未过滤的查询时,SDP特别有用。

That way perhaps you can lower that 7872 number to something more manageable. 这样也许你可以将7872号码降低到更易于管理的数字。

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

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