Page view counter

Atlas and a lengthy database operation

Last post 07-31-2006 7:40 PM by AGBrown. 4 replies.

Sort Posts:

  • Atlas and a lengthy database operation

    07-18-2006, 12:57 PM
    • Loading...
    • dimitrod
    • Joined on 11-16-2005, 10:39 PM
    • Posts 27
    Hello,

    I have a method which performs a lengthy database operation (10-20 secs) and returns the results as DataSet. I would like to call this method in an asp.net application and provide the user with an animated gif while the operation is executing. I was wondering what would be the most efficient way to implement it.

    The problem is that this method should be called on a custom thread not drawn from the asp.net thread pool because it takes long time to execute. I have implemented a custom asynchronous handler (.ashx) which performs the lenghty operation on a new thread and serializes the dataset in the response as xml.

    Now I need to call this handler from javascript, and once it returns the result it should bind it to a GridView on the page and present an animated gif to the user while working. I thought that Atlas could help me achieve this. I am new to Atlas and most of the examples I saw were dealing with webservice methods. Is it safe to implement such a lenghty operation as a webservice instead of using custom handler? If multiple clients call the webservice in the same time is it possible for the thread pool to exhaust and make new clients wait for free threads? I would appreciate your help and suggestions.
  • Re: Atlas and a lengthy database operation

    07-24-2006, 4:10 AM
    • Loading...
    • rstrahl
    • Joined on 08-20-2003, 1:08 PM
    • Paia, Hawaii
    • Posts 253
    • ASPInsiders
      TrustedFriends-MVPs

    I have a sample that does something like that here with a progress bar:

    http://www.west-wind.com/presentations/scriptcallbacks/sample/Atlas/LongProgress.aspx

    I also just posted my slides for a few sessions I did at Portland CodeCamp here which includes this sample (in updated form actually - a few UI problems with the online version <s>).

    http://west-wind.com/weblog/posts/6563.aspx

    Look either at the LongRunning Process session or the ATLAS session - both have this demo in it. The LongRunning Process one is bit more formalized with a separate library assembly that handles the Messaging between the Web app and the thread or external process that handles the processing.

    Hope this helps,

    +++ Rick ---

     

    Rick Strahl [MVP]
    West Wind Technologies
    Making waves on the Web
    www.west-wind.com/weblog
  • Re: Atlas and a lengthy database operation

    07-31-2006, 4:30 PM
    • Loading...
    • AGBrown
    • Joined on 05-26-2006, 5:53 PM
    • Posts 42
    Rick, I like your Ajax examples (I've posted a comment on your post about the longrunning example).

    In terms of messaging, a quick search under these atlas forums for "messaging" doesn't seem to indicate that server-push models are really possible. There do seem to be other ways of doing server-push models around. Has anyone looked into anything like the WebORB messaging server for use with .NET and ajax? I was going to see if I could hack together a messaging application tonight using it, but I wondered if there were any immediate problems that anyone can think of in terms of scaling with using a technique like that one. Has anyone looked into integrating something like that with Atlas (I suppose it would be a MessagingExtender of some sort)?

    Andy
  • Re: Atlas and a lengthy database operation

    07-31-2006, 6:52 PM
    • Loading...
    • rstrahl
    • Joined on 08-20-2003, 1:08 PM
    • Paia, Hawaii
    • Posts 253
    • ASPInsiders
      TrustedFriends-MVPs

    Hi Andy,

    The problem with push in an HTTP environment is that that there's no permanent connection between the client and server. HTTP is a stateless protocol - connect and disconnect so the client doesn't have a real connection to the server so any push model via HTTP is only simulating push which ever way you look at it since the browser is not capable for listening for anything on a port.

    In the end you just end up polling the server when you think you might need an update.

     

    As to the demo - sorry about that... I guess what happened is that I had the control library attached to the Solution, pulled it out and VS in its infinite wisdom pulled the assembly out of the BIN directory with it. Damn it - it's not supposed to do that <g>...

    Anyway, I've re-uploaded the projects along with some minor updates.

    The links are posted here:

    http://west-wind.com/weblog/posts/6563.aspx

    +++ Rick ---

    Rick Strahl [MVP]
    West Wind Technologies
    Making waves on the Web
    www.west-wind.com/weblog
  • Re: Atlas and a lengthy database operation

    07-31-2006, 7:40 PM
    • Loading...
    • AGBrown
    • Joined on 05-26-2006, 5:53 PM
    • Posts 42
    Agreed. It looks like you could work something out along the lines of keeping an open connection and streaming results to the client, a bit like pushlets in Java, but it might not be nice/easy. In my mind I was playing with the idea of receiving the same update message as for an asynchronous callback driven by atlas, only through the open stream, and getting atlas to do its stuff on it ... possibly pretty far-fetched given that I've only just begun with atlas.

    There do seem to be various "ajax messaging" things around, the more I look, but whether they use push or pull I don't know. The WebORB style solution looks hopeful; and although I'm going to have to wait for a few days to try it with Ajax they do have a flash demo up and running which works nicely. The problem is that its obviously third-party dependent, and I don't know how scalable/flexible it is. It would be nice just to drop an atlas extender on the page.

    I'll check the longrunning example out tomorrow.

    A.
Page 1 of 1 (5 items)
Microsoft Communities