2

I have a WCF service with Entity Framework 6 self hosted in a simple Winforms app. I have a WPF client app which hooks into this service via basicHttpbinding. On startup the client app requests a SELECT * from a large table. I need the full data set back, however the transfer across http is very slow. I have run a trace on the server and the query is dealt with very quickly by the db however the text is taking too long to return to the client. If I SELECT TOP 200 the client app is very quick so I know it's the volume of data slowing everything down. This is my client config which is mirrored server side:

   <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IIsesService" maxBufferSize="2147483647"
             maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="false"/>
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:8080/" binding="basicHttpBinding"
            bindingConfiguration="BasicHttpBinding_IIsesService" contract="ServiceReference.IIsesService"
            name="BasicHttpBinding_IIsesService" />
    </client>

I have been reading around but confused as how to tackle this issue. Unfortunately I can't page the results as the end user needs all results in a dataGrid. I am best trying to write a custom binding to allow compression or should I define Mtom or binary transfer? Can I switch to Net TCP binding when self hosting in Winforms?

Hardgraf
  • 2,566
  • 4
  • 44
  • 77
  • http://stackoverflow.com/questions/26323702/rest-wcf-stream-download-is-very-slow-with-65535-64kb-chunks-that-cant-be-ch?noredirect=1#comment45159662_26323702 – Nahum Feb 10 '15 at 11:17
  • Have you tried setting the [UseNagleAlgorithm](https://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.usenaglealgorithm(v=vs.110).aspx) property to false? This has solved problems for me when sending small requests, so it might not help here. – Chrono Feb 10 '15 at 11:50
  • Before you jump to implementing solutions determine what is actually taking time. Profile client and server. Examine CPU and network utilization. What's taking most time, what resource is maxed out? – usr Feb 10 '15 at 12:24
  • When I run a trace on the db the query completes quickly as I'd expect. 'Audit Logout' which I believe is just an indication of how long the connection is open for then follows with a duration of 27780. Query result traffic is sent back to the client which is simply added to an ObservableCollection. There is no unusual cpu usage on either client machine or machine running the service. So the connection is open far too long, doing serialization or something? When I cap the number of results returned, the process is vastly quicker... – Hardgraf Feb 10 '15 at 12:56
  • So my question really is, can I compress the data or somehow deal with it quicker than over a standard basicHttpBinding configuration whilst persisting with a self hosted design? – Hardgraf Feb 10 '15 at 13:03
  • You still have not found what's slow or bottlenecked. The computers involved surely do not simply sleep. They are *doing* something. Find out what. Is the network slow? – usr Feb 11 '15 at 09:59
  • One things that doesn't help is the buffer size, I would set it to 1024 so that the server keeps sending small packages but that is definitely why your's having the issue. The issue is most likely related to the serialization your doing and/or the query type your using (IQueryable?) Maybe show us your code and we can give some more input. – MeTitus Jun 01 '15 at 08:49

0 Answers0