Help needed with an issue related to ASP.Net and WCF Service

Discussion in 'ASP .Net' started by Nadeem Ashraf, Nov 14, 2008.

  1. Hi,

    We are developing a web based application "UltraLearn.com" with a mix of
    junior/senior Microsoft technologies. That includes Microsoft Silverlight,
    ASP.Net Ajax and WCF/WF. Recently, we have hit the wall with some of
    tested/proven technologies. The problem statement follows:

    We are calling a WCF Service from our site pages to track user navigation.
    The service in turn makes call to a gateway/server (using HttpWebRequest,
    HttpWebResponse) which just logs entries into the database. A call to the
    service is initiated from the Page_Init method of Master Page so that it is
    ensured that page will be tracked even if there is some problem while
    rendering the page. The call is asynchronous/non-blocking due to obvious
    performance reason (Quick Load Test proved that asynchronous version affects
    page's response
    time significantly)

    Here is the piece of code that is making the call from Page_Init method of
    master page:

    SiteTrackingServiceRef.SiteTrackingServiceClient trackingClient = new
    SiteTrackingServiceRef.SiteTrackingServiceClient trackingClient();
    trackingClient.StartTrackingCompleted += new
    EventHandler<SiteTrackingServiceRef.StartTrackingCompletedEventArgs>(trackingClient_StartTrackingCompleted);
    trackingClient.StartTrackingAsync(pageVisit);

    The site works perfectly fine until you put some load onto it after which it
    slows down extremely. At first, we thought that it was some networking issue
    but different tests related to congestion, DNS entries, Dos attacks etc.
    suggested against it. Then we thought that it was issue with IIS 6.0 running
    on Win2k3 (our production environment), but IIS logs and performance
    counters didn't suggest the same. Also, other sites on the same
    IIS/environment run perfectly fine. Then we unit/load tested our WCF Service
    individually to find out that
    it wasn't causing bottleneck either leaving us clueless.

    It may be worthwhile to mention that when the site starts slowing down after
    some time with variable load on the site, our WCF Service
    (SiteTrackingService) still does great job with logging the navigation. It's
    just that something happens to the page loading (or server response time)

    The following suggested solutions didn't impact the outcome in any ways.

    1) WCF Service Throttling (Making the service Singleton, PerCall, PerSession
    and/or adjusting MaxConcurrentCalls, MaxConcurrentSessions etc.)
    2) Calling the WCF Service synchronously as opposed to asynchronously

    Somebody also suggested to remove the WCF Service altogether and initiating
    navigation logging directly from ASP.Net page. But we really need to
    understand this strange behavior as our site is heavily dependent upon the
    happy marriage of ASP.Net and WCF Services. We can avoid this issue here by
    removing WCF Service altogether but not in other places. Really need some
    expert advice/help from you guys soon.

    Please note that most obvious performance counters related to CPU, Memory
    and ASP.Net processing on the server shows system to be in healthy state
    when the site slows down.

    Thanks,
    Nadeem
    Nadeem Ashraf, Nov 14, 2008
    #1
    1. Advertising

  2. Nadeem Ashraf

    bruce barker Guest

    you are incorrectly using async processing on your page. an async call runs
    on the current thread and does a callback when complete on the same thread.
    unless you page request does a wait until the async completes and turns off
    thread agility (aspcompat=true), during load the callback will happen on a
    different request. you will also stack up async calls on the same thread.

    if you use async processing, you need to switch to the
    AddOnPreRenderCompleteAsync which is the only supported way to do async
    processing on an asp.net page. this will run the aync request (and wait for
    completion just before prerender).

    you probably want to switch from async to a background thread pool to do
    your logging.


    -- bruce (sqlwork.com)


    "Nadeem Ashraf" wrote:

    > Hi,
    >
    > We are developing a web based application "UltraLearn.com" with a mix of
    > junior/senior Microsoft technologies. That includes Microsoft Silverlight,
    > ASP.Net Ajax and WCF/WF. Recently, we have hit the wall with some of
    > tested/proven technologies. The problem statement follows:
    >
    > We are calling a WCF Service from our site pages to track user navigation.
    > The service in turn makes call to a gateway/server (using HttpWebRequest,
    > HttpWebResponse) which just logs entries into the database. A call to the
    > service is initiated from the Page_Init method of Master Page so that it is
    > ensured that page will be tracked even if there is some problem while
    > rendering the page. The call is asynchronous/non-blocking due to obvious
    > performance reason (Quick Load Test proved that asynchronous version affects
    > page's response
    > time significantly)
    >
    > Here is the piece of code that is making the call from Page_Init method of
    > master page:
    >
    > SiteTrackingServiceRef.SiteTrackingServiceClient trackingClient = new
    > SiteTrackingServiceRef.SiteTrackingServiceClient trackingClient();
    > trackingClient.StartTrackingCompleted += new
    > EventHandler<SiteTrackingServiceRef.StartTrackingCompletedEventArgs>(trackingClient_StartTrackingCompleted);
    > trackingClient.StartTrackingAsync(pageVisit);
    >
    > The site works perfectly fine until you put some load onto it after which it
    > slows down extremely. At first, we thought that it was some networking issue
    > but different tests related to congestion, DNS entries, Dos attacks etc.
    > suggested against it. Then we thought that it was issue with IIS 6.0 running
    > on Win2k3 (our production environment), but IIS logs and performance
    > counters didn't suggest the same. Also, other sites on the same
    > IIS/environment run perfectly fine. Then we unit/load tested our WCF Service
    > individually to find out that
    > it wasn't causing bottleneck either leaving us clueless.
    >
    > It may be worthwhile to mention that when the site starts slowing down after
    > some time with variable load on the site, our WCF Service
    > (SiteTrackingService) still does great job with logging the navigation. It's
    > just that something happens to the page loading (or server response time)
    >
    > The following suggested solutions didn't impact the outcome in any ways.
    >
    > 1) WCF Service Throttling (Making the service Singleton, PerCall, PerSession
    > and/or adjusting MaxConcurrentCalls, MaxConcurrentSessions etc.)
    > 2) Calling the WCF Service synchronously as opposed to asynchronously
    >
    > Somebody also suggested to remove the WCF Service altogether and initiating
    > navigation logging directly from ASP.Net page. But we really need to
    > understand this strange behavior as our site is heavily dependent upon the
    > happy marriage of ASP.Net and WCF Services. We can avoid this issue here by
    > removing WCF Service altogether but not in other places. Really need some
    > expert advice/help from you guys soon.
    >
    > Please note that most obvious performance counters related to CPU, Memory
    > and ASP.Net processing on the server shows system to be in healthy state
    > when the site slows down.
    >
    > Thanks,
    > Nadeem
    >
    bruce barker, Nov 14, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon
    Replies:
    0
    Views:
    1,008
    Simon
    Oct 13, 2009
  2. Nadeem Ashraf

    WCF based full duplex service issue

    Nadeem Ashraf, Nov 3, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    1,716
    Steven Cheng
    Nov 4, 2009
  3. Cindy Lee
    Replies:
    1
    Views:
    2,104
    Mr. Arnold
    Mar 19, 2010
  4. Curt K
    Replies:
    3
    Views:
    452
    John Saunders [MVP]
    Jun 15, 2007
  5. kellygreer1

    Web Service versus WCF Service (and Books)

    kellygreer1, Nov 8, 2007, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    158
    Andrew Faust
    Nov 9, 2007
Loading...

Share This Page