I need fast transmit data from m开发者_StackOverflowy wcf service to client. As SO helps, it means good binary serializer\derializer and data through List But I've got only XML text of DataTable serialized on service. It's big overhead.
Ok I should move to binary encoding of List. I haven't any DTO, just xml of DataTable. Could you help me with best practice
PS: At client I need datatable again for processing PSS: Http,Tcp bindings of wcf service.
The first thing to try is to gzip the xml and aend via an mtom blob - simply a byte[] via wcf
If the XML is if a fixed schema, I would then consider writing some DTO translation code and send via protobuf-net and MTOM (reversing the translation at the other end).
I have an idea to pack adhoc datatables via protobuf-net but I haven't had chance to implement it yet which I discuss here: DataTable – life in the old beast?.
Indeed the first step in optimizing is getting rid of the DataTables and introducing model objects. Once this is done you could configure your service endpoint to use netTcpBinding for optimized binary transfer. Remember that this binding is not interoperable with non .NET clients so you could also have a basicHttpBinding
endpoint exposed in case you need this.
At the end of the day there should be only model objects involved in the exposed service methods (no DataTables and DataSets):
[ServiceContract]
public interface IMyServiceContract
{
[OperationContract]
SomeModel[] GetModels();
}
This being said I would recommend you performing load tests and proving that this is a bottleneck for your application before trying to prematurely optimize it.
精彩评论