locked
What is the difference between Synchronous HTTP Handler and Asynchronous HTTP Handler? RRS feed

  • Question

  • User-1331347409 posted

    Hi all,

    What is the difference between Synchronous HTTP Handler and Asynchronous HTTP Handler?

    Give me some realtime example.


    Thanks,

    Babu Kumarasamy.

    Monday, July 6, 2009 1:26 AM

Answers

  • User1528561590 posted
    • Why use HTTP handlers?

      The difference between an HTTP handler and a normal ASP.NET page is mainly performance, since an HTTP handler doesn't go through the full page events, browser compatibility tests, and formatting that a standard ASP.NET page does. Thereafter, if your page has no output (such as for audit logging) or has non-HTML output (such as XML, IMAGE, or anything else), you'll gain more scalability by implementing it as an HTTP handler.

    • Why use Asynchronous HTTP handlers?

      Asynchronous pages are a lot easier to implement in ASP.NET v2, and allow for greater scalability (more users on same hardware) on pages that require extensive I/O (thread delays while waiting for a response). When ADO.NET executes a database operation, the thread executing that will "hang" while waiting for a reply from the DB; if the latter is, for example, down and the timeout is set to 5 minutes (incredible but true), that thread will be wasted for 5 minutes. If your thread limit is set to 25, that number of users will already cause thread starvation. With asynchronous operations, the thread is released back to the thread pool while waiting for the response, and as such allows to answer to other pages on the web (that might or might not hit the DB again). In any case, it's primarily a scalability consideration that, along the run, improves performance as well (better resources usage).


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 6, 2009 6:01 AM
  • User-2126908451 posted

     

    A Synchronous handler works as lock and key once key is inserted in lock anybody can’t insert key till first key is removed from lock same functionality is in asp.net Synchronous handlers. When user request for .aspx page the request is handled by page handler.

    Similarly Asynchronous HTTP handlers allow user to start external methods such as a remote method call, and continue current process without waiting for finish external process. During process ASP.NET places the thread in thread pool until the handler receives a callback from external process. This process improves performance.

    When you create as asynchronous handler you have to implement IHttpAsyncHandler interface and must override BeginProcessRequest method to initiate as asynchronous and EndProcessRequest to run cline up process. 

    for more information see the link

    http://www.codeguru.com/csharp/.net/net_asp/print.php/c5357#more

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 6, 2009 6:18 AM

All replies

  • User1528561590 posted
    • Why use HTTP handlers?

      The difference between an HTTP handler and a normal ASP.NET page is mainly performance, since an HTTP handler doesn't go through the full page events, browser compatibility tests, and formatting that a standard ASP.NET page does. Thereafter, if your page has no output (such as for audit logging) or has non-HTML output (such as XML, IMAGE, or anything else), you'll gain more scalability by implementing it as an HTTP handler.

    • Why use Asynchronous HTTP handlers?

      Asynchronous pages are a lot easier to implement in ASP.NET v2, and allow for greater scalability (more users on same hardware) on pages that require extensive I/O (thread delays while waiting for a response). When ADO.NET executes a database operation, the thread executing that will "hang" while waiting for a reply from the DB; if the latter is, for example, down and the timeout is set to 5 minutes (incredible but true), that thread will be wasted for 5 minutes. If your thread limit is set to 25, that number of users will already cause thread starvation. With asynchronous operations, the thread is released back to the thread pool while waiting for the response, and as such allows to answer to other pages on the web (that might or might not hit the DB again). In any case, it's primarily a scalability consideration that, along the run, improves performance as well (better resources usage).


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 6, 2009 6:01 AM
  • User-2126908451 posted

     

    A Synchronous handler works as lock and key once key is inserted in lock anybody can’t insert key till first key is removed from lock same functionality is in asp.net Synchronous handlers. When user request for .aspx page the request is handled by page handler.

    Similarly Asynchronous HTTP handlers allow user to start external methods such as a remote method call, and continue current process without waiting for finish external process. During process ASP.NET places the thread in thread pool until the handler receives a callback from external process. This process improves performance.

    When you create as asynchronous handler you have to implement IHttpAsyncHandler interface and must override BeginProcessRequest method to initiate as asynchronous and EndProcessRequest to run cline up process. 

    for more information see the link

    http://www.codeguru.com/csharp/.net/net_asp/print.php/c5357#more

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 6, 2009 6:18 AM