We have an ASP.NET MVC 3 application that interacts with WCF layer for service logic. On one particular functionality the service layer takes long time to responsd, the UI timesout on svc. The processing itself is huge so it's bound to take more time. We don't want users to see timeouts, so we planned to display partial success status and keep updating the UI with status.
We are planning to split the process into various steps, some of them in kinda of fire and forget fashion. Now when user requests for details
Svc processes mandatory steps, returns response
Svc also initiates a Task fires it using below(TPL), this performs non-mandatory steps
Task.Factory.StartNew(FireAway);
UI keeps polling to update status
Tasks update completion status in DB
UI polls and retrives completion status and displays in UI
Concerns...
- Does the Thread that processes Tasks will get reused (no listener attached), will this cause too much Thread creation or leakage?
- How about resources, will Fire and forget tasks cause and Memory leakage? Task functionality is to connect to multiple DBs and update status.
- I am not happy with design (we have to do this as quick fix), any better design patterns?