views:

63

answers:

1

We currently use Silverlight 4 with WCF services and try to read large arrays of users objects from service. In our code it takes about 0.5 (and less) seconds to generate 700 objects, arranged by hierarchy (a lot of loops).

And it takes about 4-5 seconds for Silverlight/WCF to communicate that data - on localhost.

I've measured timings in my code / service call, used Fiddler to see data (5MBs!), and when I tried to pass a simplified object with plain attributes (instead of nested lists, etc), it took much less amount of data and was very quick - like, a second.

I've read many articles on the subject - there's no simple way, the best I could find is to return byte[] from WCF method (and have types in the separate assembly), or highly manual serializers (like protobuf) that require to write custom attributes, etc.

OK I tried those. protobuf-net is extremely hard (adding numbers to 200 existing classes isn't fun), and v2 is not here yet, and binaryMessageEncoding reduced data load from 5.5MB to 4.5MB, not too much.

But, I can't believe, is there any out-of-the-box WCF/Silverlight solution to stream large amounts of data? Isn't it supposed to be a nice modern technology for enterprise solutions?

How do I tell Silverlight/WCF to stream my data faster and smaller, rather than 5MBs in 5 seconds? Can I just say in config: "use small and fast serializer"?

A: 

Does IIS have compression enabled. This will however impact CPU and you might need to double check if silverlight honors the deflate http header?

Sajay
Right, compression takes CPU - and more important, time, so that it will sum up with the big time that WCF/Silverlight spend serializing array of objects - this is what takes most of the time (because transferring any amount of data on localhost is fast).
queen3
I would suggest profiling the service to see where the time is actually being spent. Even on local host you have an upper bound and tcpip.sys is smart enough to bypass the NIC. What serializer are you using, datacontract with binary encoder?
Sajay