I have a WCF service that searches and returns a list of fairly complex objects to the client. This is an EAV system, so each returned object has a list of attached values, the size of which depends on the size of the object.
In my test search, I confirmed through registration that the actual search took less than a second to complete in almost every case. The last thing I do before returning the response to the client is the record that completed processing.
Unfortunately, the client does not receive a response until 15-20 seconds after I finished with it. The total response size is about 250 kb, so it is rather small. This is transmitted over the local network for a minute, and I tried to disable the firewall and antivirus to make sure that they did not interfere.
I noticed, however, that if the answer was much smaller, for example, by removing the fields attached to each object, the answer was much faster. I also tried going through a locally hosted (IIS) copy of the service, and after passing the final return
it still took another 15 seconds to reach the local client application.
I use basicHttpBinding, because the service will be consumed by both .NET and PHP clients.
Now, can anyone suggest a way that I can confirm that this is indeed the case? And how can I fix a maliciously slow serialization time?
Edit:
To clarify, I marked each class with the [DataContract] attribute and each property with [DataMember] - WCF handles serialization when I return the data. In this case, it is a list of Entity types (a custom class that contains a list of values.
Edit 2:
I tested the speed of a DataContractSerializer and it took about 15 seconds to write a list of 65 returned objects to a simple memory stream. It seems ridiculous, and I'm not sure what has changed to make it so painfully slow.