Sean

Sean

  • NA
  • 1
  • 4.1k

WCF serialization is slow at the first call

Dec 27 2011 4:51 AM
I'm using .Net 3.5 sp1, working with the default WCF serializer - DataContractSerializer.
I have this simple interface:
[ServiceContract]
public interface IService
{

[OperationContract]

void RecieveInteger(int value);


[OperationContract]

void RecieveBigDataType(BigDataType value);

}

My client does the following.
1. Create a ServiceClient object.
2. Invokes 'RecieveInteger' just to warm-up the service.
3. Invokes 'RecieveBigDataType' 10 times and measure performance.

Measuring the 10 calls to 'RecieveBigDataType', I found the first call is much slower than the others. It seems like the first time WCF needs to serialize the type 'BigDataType' is happeing very slow.
Any ideas how to make the first call faster?