I suggest dividing the application into two parts.
- Web service. This is the functionality:
- Get a work item from a client;
- Transfer this work to a server service that does the actual work;
- Report progress and results;
- Backend service. This is the functionality:
- Process web service requests;
- Perform the actual calculation.
The reasons for this design: 1) it is relatively difficult to handle the workload in a hosted application (ASP.NET), because the server (IIS) will manage resources, while in a separate application you have more direct control;
2) the two-level design is more scalable - for example, later you can easily move the backend to another physical machine (or several machines).
The web service should be inactive - for example, after the request is accepted, the user will return some identifier and use this identifier to poll the service for the result.
The backend server should probably support a queue of processing requests and a set of workflows that process them. Workers must monitor available resources and ensure that they do not overload the machine (and, of course, gracefully handle all possible error conditions).
VladV
source share