WCF Timeouts when saving large collections

WCF Timeouts when saving large collections

Old forum URL: forums.lhotka.net/forums/t/7925.aspx


richardmccavery posted on Monday, November 02, 2009

I'm using the WCF data portal and I have noticed that whilst when calling Save() on a BusinessListBase collection of 87 objects (each object with child collections etc) I either get a :-

CommunicationException "An error (The request was aborted: The request was canceled.) occurred while transmitting data over the HTTP channel."

OR if using ReliableSession=true a

TimeoutException "The request channel timed out while waiting for a reply after 00:00:57.9720000. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout."

I have discovered that essentially during my Save operation all 87 objects are being passed to the dataportal update WCF call, regardless of whether they are dirty or not.

Can and should the WCF data portal be used for this type of update and if so, what is the best way to either make the Save() more efficient or prevent this error occuring ?

Any thoughts would be most appreciated.

richardmccavery replied on Monday, November 02, 2009

I have set the value :-



in my web.config file for my WCF portal and no longer get the error messages.

The save however is still slower than perhaps it should be because it's passing all 87 objects to the DataPortal_Update call.

Is there any way of making this more efficient ?

JonnyBee replied on Monday, November 02, 2009

Hi,

I guess you have another problem. If the save operation isn't completed with 1 minute (which you can increase tho)  you should look at you DAL and how the save is performed. You could get into database deadlocks or other problems that stops the serverside thread for finishing.

Another issue is if you are doing MQ in you DAL and are not able to get a response - this will cause your thread to hang and the client will eventually get a timeout.

So - what I'm trying to say is that you must check what happends on the server during save. I'm assuming that it is not the transmission over "wire" that is  the problem.

Csla by default does not use DiffGrams or transmits just the modified bits (as diskussed in Rockys book). There is tho a small sample in samples download that shows a possible way of doing Diffgrams.

DocJames replied on Monday, November 02, 2009

Hi,

If you take a look at the code found in this discussion: http://forums.lhotka.net/forums/thread/29681.aspx you can see how to only update changed items.

The code is old, but still works :)

Also note the other posts - there is some discussion about only sending the Dirty objects when updating.

Thanks,
Jimmy

richardmccavery replied on Monday, November 02, 2009

The combination of the IIS setting change and the "only saving dirty items" code change you suggested have transformed my application !!!

18 seconds down to sub second. I knew it wasn't my data access layer !

Many thanks guys !

Copyright (c) Marimer LLC