none
Async Design Patterns RRS feed

  • Question

  • I am confused about asynchronous design pattern.

    Below is an article that I am following: http://msdn.microsoft.com/en-us/library/ff647786.aspx

    Do Not Use Asynchronous Web Methods When You Depend on Worker Threads

    You should not implement Web methods when your asynchronous
    implementation depends upon callbacks or delegates because they use
    worker threads internally. Although the delegate frees the worker thread
    processing the request, it uses another worker thread from the process
    thread pool to execute the method. This is a thread that can be used for
    processing other incoming requests to the Web service. The result is
    that you consume a worker thread for the delegate-based operation and
    you increase context switching.

    Consider Calling Web Services Asynchronously When You Have Additional Parallel Work

    Asynchronous invocation is the most useful when the client has
    additional work that it can perform while the Web method executes.
    Asynchronous calls to Web services result in performance and throughput
    gains because you free the executing worker thread to do parallel work
    before it is blocked by the Web services call and waits for the results.
    This lets you concurrently process any work that is not dependent on
    the results of the Web services call.

    This article is from May 2004. Is this still relevant? Does it mean that callbacks and delegates do not really serve the purpose when used in the context of an asynchronous call?

    Tuesday, December 17, 2013 10:30 PM

Answers

  • Hi,

    >>This article is from May 2004. Is this still relevant?

    In my mind, I think this article is still relevant.

    >>Does it mean that callbacks and delegates do not really serve the purpose when used in the context of an asynchronous call

    Yes, because they use worker threads internally.

    Async delegates use threads from the thread pool so they should be faster compared to manual thread creation. Be careful though with this in ASP.NET applications. Because you will be eating up worker threads that are normally used by ASP.NET to service requests and your application might very quickly run out of servicing capabilities.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by diffident Thursday, December 19, 2013 4:43 PM
    Wednesday, December 18, 2013 6:01 AM
    Moderator