Best practices for WF in ASP- workflow instances

bri189a

Senior Contributor
Joined
Sep 11, 2003
Messages
1,004
Location
VA
So I know how to safely create the runtime my question gets into workflow instances.

When you call instance.Start() it gets executed on another thread; more than likely this WF isn't going to be instant, so you need to wait for the completed event, but to do this without having the page already render to the client you have to use the whole AutoResetEvent.WaitOne() and the release method on the completed method.

Well it doesn't take a genius to figure out what's going to happen if 50 people are concurrently using the web application and are in different parts of a work-flow - the site is going to crawl.

So it seems this thread pausing method, while needed for windows apps, isn't desirable for web apps; what is the best practice for this then? You don't want to lose sight of the workflow by the page rendering before the workflow is complete; but at the same time you don't want to pause the execution thread of ASP.NET making everyone else wait while these workflows complete. In my tests, 2 users didn't seem to be a problem - my timer which would block the WF would allow the second user to work, but then once I got a third user started the first user was still blocking, and now the second was in a WF that was blocking, and the third just sat there waiting for the site to load up. Once the first user finished, ASP was unblocked and the third user could continue.


This is the behavior I would expect - they don't say 'don't mess with the thread in web apps' for a reason; but I always like to blow things up to see what will happen. Anyway...so how are we suppose to do this in the web world? Links, suggestions, welcome.

Thanks!
 
Back
Top