Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well first off, my requirements are not quite the same as yours. My problem was that my backend database tends to be a little slow, and user responsiveness was extremely important.</p> <p>Therefore, I had to remove the database interaction from the equation.</p> <p>My solution has two main parts:</p> <ol> <li><p>Maintain a server side cache of the data</p></li> <li><p>Create a separate process to contain all database work that can interact with the server</p></li> </ol> <p>The separate process was implemented as a named pipe WCF service hosted by a windows service.</p> <p>The basic process overview is:</p> <ol> <li>User clicks "Save", Ajax post the form to an Mvc controller</li> <li>The controller updates the cache data, then invokes the WCF pipe</li> <li>The service pushes the data into a concurrent queue (along with a session ID), and returns a guid token</li> <li>The controller returns the token as a JSON response.</li> <li>jQuery Ajax handler intercepts the response and saves the token into a UI element that 6. represents the "Saved" form.</li> </ol> <p>The service itself works like this:</p> <ol> <li>On start create a timer.</li> <li>On Timer tick:</li> <li>Stop the timer.</li> <li>Remove all queued work items from the concurrent queue</li> <li>Send each item to be processed by the work processor</li> <li>Add the item to the "Completed", or "Has an Error" concurrent dictionaries, keyed by the earlier session Id (along with some time keeping stuff to eliminate stale data). This includes the original work token.</li> <li>Start the timer again.</li> </ol> <p>Back in user land, there is a javascript setInterval loop running:</p> <ol> <li>Ajax request to the server (Heartbeat controller)</li> <li>The controller connects to the service, and passes the current session id</li> <li>The service returns all items from the "Completed" and "Error" dictionaries</li> <li>The controller returns the lists as JSON object arrays</li> <li>The javascript loops through the returned lists and uses the tokens to do appropriate UI updates</li> </ol> <p>The end result is a very responsive UI despite the slow backend persistence server.</p> <p>If you want any specific portions of implementation code let me know.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload