简体   繁体   English

Silverlight 4最快的WCF绑定

[英]Fastest WCF binding for Silverlight 4

I'm working on a project where a Silverlight 4 client calls a WCF webservice that returns a large amount of data. 我正在一个Silverlight 4客户端调用返回大量数据的WCF Web服务的项目中。 Some profiling revealed that 一些分析显示

  • actual execution of the webservice method takes less than one second (calls another server/generates a very large dataset/etc., it's already pretty optimized there) webservice方法的实际执行时间不到一秒钟(调用另一台服务器/生成一个非常大的数据集等,已经在那里进行了优化)

  • data transfer depends on the network, but is generally not a problem -it can take whatever it needs 数据传输取决于网络,但通常不是问题-它可以根据需要进行传输

  • time between the client receives the http answer (I see it as completed in Fiddler) and the Completed event fired in the Silverlight client: ~15 seconds (no difference between IE/firefox/chrome) 客户端收到http答案(我在Fiddler中看到它已完成)与Silverlight客户端中触发的Completed事件之间的时间〜15秒 (IE / firefox / chrome之间没有区别)

I suppose that the 15 seconds delay is in large part spent in deserialization. 我认为15秒钟的延迟大部分用于反序列化。

My binding uses HttpTransport and BinaryMessageEncoding , with gzip compression on top of it. 我的绑定使用HttpTransportBinaryMessageEncoding ,并在其顶部进行gzip压缩。 Gzip compression seems not to have an impact on performance: the difference between no compression and maximum compression level is pretty much inexistent. Gzip压缩似乎对性能没有影响:无压缩和最大压缩级别之间的差异几乎不存在。 The http answer is ~15 Mb uncompressed and ~400 kb compressed (a lot of overhead even with the binary XML!) http答案是未压缩的〜15 Mb和压缩的〜400 kb(即使使用二进制XML也会产生很多开销!)

Note: the web service is completely ad hoc, I'm not interested in interoperability and have total freedom in the choice of protocol. 注意:Web服务完全是临时的,我对互操作性不感兴趣,并且在选择协议方面拥有完全的自由。

An obvious solution would be to transfer less data, but introducing paging would require some major changes in architecture that are not doable at the current time. 一个明显的解决方案是传输较少的数据,但是引入分页将需要对体系结构进行一些重大更改,而这些更改目前尚不可行。 Reducing the dataset is also rather difficult because the solution is completely customizable by the end-user, and as you know users do not always know what they are doing and end up creating huge requests. 减少数据集也相当困难,因为该解决方案完全可以由最终用户定制,并且您知道用户并不总是知道自己在做什么,最终导致创建大量请求。

I'm left with the wcf binding: this project started with SL 2 and evolved through SL 3 and SL 4, so maybe I'm missing some kind of faster binding introduced in Silverlight 4. Is there another faster encoder (or binding) I can use to avoid the deserialization bottleneck on the client? 我剩下wcf绑定了:该项目从SL 2开始,并通过SL 3和SL 4进行了演变,因此也许我缺少Silverlight 4中引入的某种更快的绑定。我还有另一个更快的编码器(或绑定)吗?可以用来避免客户端上的反序列化瓶颈?

How about "cheating" (Improving only the precieved performance) ? 怎么样“作弊”(仅提高预期的性能)?

Return a small subset of the data on the first call, then spin up a background process to fetch all that you need. 在第一次调用时返回一小部分数据,然后启动一个后台进程以获取所需的所有信息。 If the data you display is readonly, then this could help. 如果您显示的数据为只读数据,则可能会有所帮助。

Edit: Look at priority binding... It allows you to bind multiple datasources to your grid. 编辑:查看优先级绑定...它允许您将多个数据源绑定到您的网格。 If the slow connection will return later, silverlight will bind the new datasource automatically... 如果慢速连接稍后再返回,silverlight将自动绑定新的数据源...

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

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