0

I have a weird scenario which clearly states I do not understand WCF as good as I should.

I list 50 000 records and create "Entities" that I want to return to my front end. The whole process takes under 2 seconds to complete.

But then the serialization start server side - outside my "code" - but it uses only one processor to serialize the data - this takes 4 minutes? Except for overriding the "onserialize" - what other options is there available?

I make use of BasicHttpChannel - no security currently - and encoding is default - not MTOM.

Any advice would be great - thanks!

EDIT:

I have a simple load call which returns a POCO (nothing special) - only the data - 5 properties - all strings - one long.

EDIT: To clarify - to load the data from the frontend via WCF till the data (POCO's) reach the "entry point" again where the "call" is returned takes 2 seconds.
Thereafter I see only my one processor "spike" up to 100% for approximately 4 minutes - my opinion is this is where the data is serialized to be returned - I want to know whether WCF has an option to allow more processor to do this work - or is my only option to override OnSerializing?

d1trut5r
  • 1
  • 4
  • 1
    What do your "entities" look like? Are they heavily decorated Entity Framework classes with multiple navigation properties (possibly even circular references), or lean DTO's with little to no nesting? – CodeCaster Jul 21 '16 at 09:36
  • It's unlikely we'll be able to help you with just this information. Can you provide a [mcve]? What do your service, operation and data contracts look like? Are your returned simple POCOs or something else? You mention "Entity". Are you using entity framework? If so, what version? Have you tried [replacing `XmlSerializer` with `DataContractSerializer`](https://msdn.microsoft.com/en-us/library/ms733901(v=vs.110).aspx)? If so, what was the performance impact? – dbc Jul 21 '16 at 09:41
  • Yes - I have a simple load call which returns a POCO (nothing special) - only the data - 5 properties - all strings - one long. All I can sate is that if it gets to serialization I can clearly see that only 1 of my 10 CPU's run at 100% while the other all idle when it serializes my data - but the actual load call makes use of all processors. – d1trut5r Jul 21 '16 at 10:01
  • 1
    Write a test mockup that serializes this kind of dat w/o WCF. Try to optimize it. If you can do this successfully with something other than DataContracts then send it as strings. – H H Jul 21 '16 at 10:07
  • Do you have lazy loading enabled? See https://msdn.microsoft.com/en-us/library/dd456846.aspx – dbc Jul 21 '16 at 10:38

1 Answers1

-1

Link: Transfer large amount of data in WCF service

Another possibility is to reduce the amount of records which have to be serialized by the WCF-Service. You may check, whether the record was updated since the last request and only return those records which have been changed to the frontend.

Community
  • 1
  • 1
rbr94
  • 2,227
  • 3
  • 23
  • 39
  • Hi - thanks for the feedback - unfortunately that is the case - we had 50 000 requests that happened - we need to process those requests... – d1trut5r Jul 21 '16 at 09:25
  • You shouldn't post links as answers, but explain what is being discussed in said link. This particular link explains how you can send large responses from WCF, which OP is already succeeding to do. – CodeCaster Jul 21 '16 at 09:35