| Prev | Next
Menu: Products - Portfolio - Services - Download - Order - Company

 
Topic #1.1.1.1.1.1.
WebHub App Servers
   Teamwork  
   Fully Dynamic  
   Save-State  
   UI vs Process  
   A HREF links  
   DB Support  
   Bkgrnd Processing  
   Security  
*

  

Browsing >>Bkgrnd Processing: Using special classes for handling tasks in the background

Sync Processing
Normal WebHub traffic is syncronous, that is, each request must wait until the one before it has finished. The speed of the Hub and the EXE's serving the surfers ensure that no one is kept waiting. But what if the page being requested requires a database query (or something else that might take a long time)? The EXE handling that surfer makes the query, and then waits for the result, not able to handle any other requests, or even to finish building the page for the waiting surfer, until the lengthy process has completed. At best, the surfer experiences sluggish performance, and at worst, the connection might time out before the page is ever displayed. This is an inherent limitation of syncronous processing.

ASync Processing
An asyncronous WebHub App works a little differently. When its main thread receives a request for a page that will require a long time to construct, it spawns a dedicated worker thread to handle the long task, and then can return a page to the surfer informing him of the progress of the request. The App is now free to handle additional requests, either from the original surfer, to whom it can reply with status updates, or from other surfers, in which case it can spawn off additional threads to handle their queries as necessary. When the worker thread finishes processing, its results are made available to the App's main thread, and the worker thread is terminated. The App is then free to pass the results on to the surfer, either immediately, if the connection was kept open, or on the next reload of the page.

See the ASync Demo for much more detail, several running examples and code samples

The WebHub ASync classes are included as of version 1.63. Source is part of HtPlus Pack.


 
Path:  www.href.com to; Products to; WebHub to; Diagrams, Overview to; Dynamic Sites to; WebHub App Servers to; Bkgrnd Processing

Copyright © 1995-2012 HREF Tools Corp. All Rights Reserved Worldwide.
Running: WebHub-v2.167 compiled with d16_win32 on Microsoft-IIS/7.5,
Local Time: Mon, 21 May 2012 13:10:23.
Session 1700442986, 2 pages sent to CCBot/1.0 (+http://www.commoncrawl.org/bot.html) at 38.107.179.228;
Time to produce this page: 0msec.