TechEd Blogging: Wednesday's Cabana Question of the Day

Attendee question of the day: 

A long running CPU and memory intensive piece of work needs to be done when requested by a user in an ASP.NET application and then reported back to the user when complete.  How do you do it without placing too much load on the ASP.NET server?

A possible solution:

Start a new thread from the ASP.NET request.  This new thread should not do the work itself but rather use Remoting to invoke the work on a remote server (that may be dedicated to the intensive work).  But how do you get updates back to the user?  You can either do it in a truly disconnected manner by sending an email to the user when the work is complete or you can have something on the user's browser poll back to the server for updates.  Possibly looking in Cache for updates posted by the thread using the Remoting object.  You could do this polling using a simple META REFRESH (ugly) or use something more elegant (and lightweight) such as Remote Scripting.

I implemented a very similar solution to kick off NAnt scripts and watch their output from an ASP.NET application.  It used Remoting to a ScriptRunner object hosted by a Windows Service.  All output was captured by the ScriptRunner and then retrieved using Remote Scripting calls to get the status update from the thread holding the reference to the Remoted object inside ASP.NET.

No Comments