asp.net mvc 2 - Can I use async controllers in the following scenario? -
i have application in asp.net mvc @ point display modal dialog user display process execution progress indicator.
the process behind scenes lot of database data processing (based on existing data generates lots of resulting records written database well). process may take brief moment long time (depending on existing data).
application initiate process asynchronously (via ajax request) , display progress in same manner.
the problem
i've read bit async controllers 1 can asynchronously start process , informed end of there's no progress indication , i'm not sure how browser timeouts handled. far client goes async request same synchronous one. client therefore wait response (as understand it). main difference being server execute in async manner won't block other incoming requests. should is:
- make request start process , respond client taht process has started.
- client them periodically poll server process progress status getting immediate response percentage value (probably json)
- when progress 100% mean ended client know make request results.
i'm not convinced async controllers work way...
the thing i'm not sure understand async controllers hence not sure approach should use approach problem described? see 2 possibilities myself:
- asp.net mvc async controllers if can work way
- windows service app processes data on request , reports progress - service started writing particular record db using normal controller action; start , service writing progress status db asp.net mvc app able read on client process polling requests.
i haven't used asynch controllers myself in project. here's link has.
asynchronous-processing-in-asp-net-mvc-with-ajax-progress-bar
i have used number 2 in large production project.
number 2 service app running on separate server using openssh communicate between 2 servers. we'd poll progress periodically update progress bar clients ui via ajax.
additionally separating web server long running process separating concerns. web server not interested in writing files disk, handling io, etc , shouldn't burdended such.
if long running process has killed or fails wont affect web server handling requests, , processing transactions.
another suggestion extremely long running process not burden client waiting, give them option come later see progress. i.e. send them e-mail when done.
or show them interesting, in our case had signed java applet show process doing @ exact moment.
Comments
Post a Comment