none
System.Net.ConnectStream WriteHeaders slow RRS feed

  • Question

  • Hello,

    I am working on a system, where we have more than one WCF services. I have a WCF service (A) whose method M1 calls a method M2 of another WCF service (B). Also, the service A uses NHibernate and B uses EntityFramework 5.0. We have done almost all the "best practices" for performance enhancement for both NHibernate and EF. 

    For Service A method M1: The service is hosted on IIS on a remote server S1. M1 calls M2 of service B. On an average M1 of service A takes 2-3 seconds. From which we can assume that M2 of service B is taking approx 1 second. But the first calls for both the services takes much more time. For first time,  M1 of service A takes 17-20 seconds and the worst case goes to 69 seconds. 

    For Service B method M2: The service is hosted on IIS on same remote server S1. When we call M2 individually, on an avg it takes 1 second or less to give response. But for the first call it takes 10-11 seconds and the worst case goes to 30 seconds.

    I have user NHibernate Profiler and Entity Framework Profiler and optimized queries, pre-generated views in case of EF. But how can I reduce the first execution time for a query as EF takes comparatively more time to execute a unique query for the first time.

    Also, then I used New Relic for profiling the performance. And we found that while calling method M1 of service A the System.Net.ConnectStream WriteHeaders is taking most of the time of the delays we are experiencing. 

    In this case the method M1 was taking overall 18561 ms, out of which System.Net.ConnectStream WriteHeaders alone is taking 18500 ms. What can I do to reduce this time and why does it take so much time. Also, I am not giving any header in the request.

    Please help.

    Thanks.

    (Sorry, for so confusing question, but I am not getting what causing my service to get so slow and also how can i explain this issue in a question easily understood :| .)


    Deepti

    Tuesday, April 2, 2013 1:40 PM

All replies