Reputation: 9290
I'm working on a project where a Silverlight 4 client calls a WCF webservice that returns a large amount of data. 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)
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)
I suppose that the 15 seconds delay is in large part spent in deserialization.
My binding uses HttpTransport
and BinaryMessageEncoding
, with gzip compression on top of it.
Gzip compression seems not to have an impact on performance: the difference between no compression and maximum compression level is pretty much inexistent. The http answer is ~15 Mb uncompressed and ~400 kb compressed (a lot of overhead even with the binary XML!)
Note: the web service is completely ad hoc, I'm not interested in interoperability and have total freedom in the choice of protocol.
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?
Upvotes: 4
Views: 709
Reputation: 3197
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...
Upvotes: 2