none
Performance improvement of WCF data transfer to client RRS feed

  • Question

  • We are using a WCF service. We are trying to return data of size 3MB to our client/application from WCF.

    When we do in locally its just taking 2 seconds. We have hosted the service on a server and when we tried accessing it in the same location its just 2 seconds. But when we try to access it from other geographic region or location it is taking around 40 seconds.

    We have tried using Mtom and streamed response but we did not have any improvement. It would be of great help if anyone can let us know a means to improve the performance when accessing it from different region?

    Monday, November 21, 2016 9:16 AM

All replies

  • Hi Subash,

    It would be helpful if you can explain a bit about the WCF service you have developed wiz the binding used, security mode used etc. 

    You have not mentioned where is the slowness being observed ? Is it observed only once , or every time ?

    There can be a number of factors that can impact the service performance, including (but not limited to) Network Latency, Security Mode, Binding used.

    Are you facing any issues with a generic "Hello World" service with no or very little data transfer? What are the response times for that?

    This information will help us in understanding the actual problem you are facing.

    Regards,

    Chirag Dave

    Monday, November 21, 2016 10:37 AM
  • Hi Chirag,

    We are using basichttp binding and we are not using any security mode.

    The slowness is not once its every time. The time taken by hello world is just 1 or 2 seconds. Its only as the datasize increases the time increases. For a 3MB data it is taking around 30 to 40 seconds.

    Please let us know if we need any other details.

    Thanks,

    Subhash

    Tuesday, November 22, 2016 4:07 AM
  • Hi Subhash,

    What do you mean by different regions? They are in different cities or countries?

    Based on your description, I assume your issue is related with network. You could assume that you pass a simple string “hello world”, it will waste 2 seconds, how long will it need for 3MB?

    If you make a test with 3MB from different computer under the same network, how long will it take?

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 23, 2016 6:06 AM
  • Hi Chirag,

    I mean different countries. Its the same accessing it from a different computer in the same region. Please find below the service config binding and attached fiddler data for this call from client.

    <

    basicHttpBinding>

          <

    bindingcloseTimeout="00:1:00

    openTimeout="00:01:00"receiveTimeout="00:1:00"sendTimeout="00:1:00"

    allowCookies="false"bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

    maxBufferSize="2147483647"maxBufferPoolSize="524288"maxReceivedMessageSize="2147483647"

    messageEncoding="Mtom"textEncoding="utf-8"transferMode="StreamedResponse"

    useDefaultWebProxy="true">

                </

    binding>

        </

    basicHttpBinding>

    Thanks,

    Subhash


         


    Wednesday, November 23, 2016 8:36 AM
  • Hi Subhash,

    How many requests will be sent to WCF Service at the same time? If there is only one client to send request, will it need 40s? If you send a request with 3MB body, will it need 40s?

    Could you share us your WCF methods? Is the 3MB a file stream or data from database?

    If you download a 3MB file from Server by FTP, how long will it take?

    In addition, I suggest you check whether the link below is helpful.

    # WCF scales up slowly with bursts of work

    https://blogs.msdn.microsoft.com/dmetzgar/2011/05/04/wcf-scales-up-slowly-with-bursts-of-work/

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Thursday, November 24, 2016 2:27 AM
  • When we do in locally its just taking 2 seconds. We have hosted the service on a server and when we tried accessing it in the same location its just 2 seconds. But when we try to access it from other geographic region or location it is taking around 40 seconds.

    Comon man the hops alone can be killing you.

    https://www.lifewire.com/what-are-hops-hop-counts-2625905

    You don't know how the traffic is being routed. Heck the packets could have been sent to the moon  between destinations on the trip. :)

    http://www.informit.com/articles/article.aspx?p=131034&seqNum=5

    Thursday, November 24, 2016 4:06 AM
  • Hi Edward,

    We are sending only one request at a time from client to WCF Service. While we are testing no one else is making calls to the WCF service.

    The 3 MB is a data from database.

    We also tried with WebAPI returning 2.3MB data. It is just taking 5 seconds. PFA the link which contains the fiddler analysis.

    Please let us know if you need any other information.

    Thanks,

    Subhash

    Wednesday, January 18, 2017 12:07 PM
  • Hi Subhash,

    Thank you for posting in the MSDN Forum.

    I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!

    Best Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 19, 2017 1:46 AM
  • Hi Edward,

    Thanks a lot. Any help as soon as possible is greatly appreciated.

    Best Regards,

    Subhash

    Monday, January 23, 2017 12:27 PM
  • Hi Subhash,

    You can enable the WCF trace on both server and client side and then reproduce the issue. You can append the following xml into the web.config of your WCF client app and server app. All we set switchValue to "All", which will record all the logs but the log size will grow fast.

            ================

    <configuration>

    <system.diagnostics>

    <sources>

    <source name="System.ServiceModel" switchValue="All" propagateActivity="true">

    <listeners>

    <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces.svclog" />

    </listeners>

    </source>

    </sources>

    <trace autoflush="true" />

    </system.diagnostics>

    </configuration>

    =========================

    Ref: https://msdn.microsoft.com/en-us/library/ms733025(v=vs.110).aspx

    Then you can check the WCF log to find out what consumes most time.

    Ref: https://msdn.microsoft.com/en-us/library/aa751795(v=vs.110).aspx

    If slowness is network, then we need to engage network team to check the network issue.

    If slowness is from WCF application itself, then we need to take memory dump.

    How to use DebugDiag to get memory dump:https://blogs.msdn.microsoft.com/asiatech/2014/01/09/debug-diagnostic-2-0-creating-a-rule-in-hang-mode-to-use-the-response-time-of-the-request/

    How to use DebugDiag Analysis to analyze memory dump:https://msdn.microsoft.com/en-us/library/aa577477.aspx

    BR,

    Zhiqing


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Wednesday, January 25, 2017 8:29 AM
  • Hi Zhiqing,

    We have added the above suggested diagnostics . Please refer to the client side (client side trace ) and server side ( server side trace )  traces.

    From these traces we are of opinion that the clinet side transfer is taking time (34 seconds) suggesting a network issue but with web api the data transfer is fast contradicting it.

    Can you please have a look at the traces for the activity "Process action 'http://tempuri.org/IEBTService/GetLineitemeventfactdata' " and let us know the possible reason for the issue and its resolution.

    Thanks in Advance,

    Subhash


    • Edited by Subhash Banda Monday, January 30, 2017 12:02 PM correct the client side hyperlink
    Monday, January 30, 2017 11:59 AM
  • Hi Subhash,

    When I click the links of the trace, it is written as below:

    "This item might have been deleted, expired, or you might not have permission to view it. Contact the owner of this item for more information."

    I cannot get the trace. Can you please check?

    Thanks!

    Zhiqing


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, February 7, 2017 1:38 AM
  • Hi Zhiqing,

    We have collected the client side network capture and have sent you the same over mail. Can you please take a look at it and help us in analyzing it.

    Thanks,

    Subhash

    Friday, February 10, 2017 12:00 PM
  • Dear Subhash

    Your question falls into a category which requires a more in-depth level of support.  Please visit the below link to see the various free and paid support options that are available to better meet your needs. http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Best regards,

    Zhiqing


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Wednesday, February 15, 2017 10:41 AM