We're creating an ASP.NET service that presents a REST API. Is there a good resource on how best we should set this up on IIS? Our service can take between seconds to minutes to process a request.
The big questions I see are:
If it's an async request (give us the request, return immediately before the request is processed), can we pass that job off to IIS and it has a pool of worker threads to process it?
How can we get the status of any background job?
How can we get the number of pending jobs?
If it's a sync request, will that then go before any pending requests?
And limits on request or response size? The requests will generally be 5M - 50M, and sometimes up to several G. The response on completion will tend to be 20M - 200M and again can be several G.
IIS simply hosts a web application/service. All of your questions are related to designing and writing a web application/service which encompasses the entire .NET stack.
david@windward.net
If it's an async request (give us the request, return immediately before the request is processed), can we pass that job off to IIS and it has a pool of worker threads to process it?
Sure...
david@windward.net
How can we get the status of any background job?
It's a matter of state management which is a problem that must be solved in every web application. One solution is designing the background job to save its current status in a database table. The client reads the table to find the status.
david@windward.net
How can we get the number of pending jobs?
Same as above.
david@windward.net
If it's a sync request, will that then go before any pending requests?
I have no idea how you application works and cannot answer this question. Keep in mind each HTTP request is a separate thread.
david@windward.net
And limits on request or response size? The requests will generally be 5M - 50M, and sometimes up to several G. The response on completion will tend to be 20M - 200M and again can be several G.
It is more efficient if you can process the 5M - 50M without sending the data over HTTP.
david@windward.net
What else am I missing?
Can you explain the user case for creating the service?
Thank you for your reply. Let me ask a more basic question and I may have a misconception here.
Doesn't IIS provide the ability to hand off background tasks to it to process from an app pool? If so, that let's me avoid creating my own job queue, thread pool, etc.
Doesn't IIS provide the ability to hand off background tasks to it to process from an app pool?
A web site is just an
HTTP service; one request, one response. It is up to you to design and write the background task logic. Keep in mind, web application are not good candidates for running background tasks. Web applications spin down after non use which will stop the
background task unexpectedly.
An application pool defines a group of one or more worker processes, configured with common settings that serve requests to one or more applications that are assigned to that application pool. Because application pools allow a set of Web applications
to share one or more similarly configured worker processes, they provide a convenient way to isolate a set of Web applications from other Web applications on the server computer. Process boundaries separate each worker process; therefore, application problems
in one application pool do not affect Web sites or applications in other application pools. Application pools significantly increase both the reliability and manageability of your Web infrastructure.
Member
24 Points
247 Posts
Good resource to best utilize IIS
Apr 03, 2020 03:26 PM|david@windward.net|LINK
Hi all;
We're creating an ASP.NET service that presents a REST API. Is there a good resource on how best we should set this up on IIS? Our service can take between seconds to minutes to process a request.
The big questions I see are:
??? - thanks - dave
All-Star
53641 Points
24007 Posts
Re: Good resource to best utilize IIS
Apr 03, 2020 03:45 PM|mgebhard|LINK
IIS simply hosts a web application/service. All of your questions are related to designing and writing a web application/service which encompasses the entire .NET stack.
Sure...
It's a matter of state management which is a problem that must be solved in every web application. One solution is designing the background job to save its current status in a database table. The client reads the table to find the status.
Same as above.
I have no idea how you application works and cannot answer this question. Keep in mind each HTTP request is a separate thread.
It is more efficient if you can process the 5M - 50M without sending the data over HTTP.
Can you explain the user case for creating the service?
Member
24 Points
247 Posts
Re: Good resource to best utilize IIS
Apr 03, 2020 03:54 PM|david@windward.net|LINK
Hi mgebhard;
Thank you for your reply. Let me ask a more basic question and I may have a misconception here.
Doesn't IIS provide the ability to hand off background tasks to it to process from an app pool? If so, that let's me avoid creating my own job queue, thread pool, etc.
??? - dave
All-Star
53641 Points
24007 Posts
Re: Good resource to best utilize IIS
Apr 03, 2020 04:15 PM|mgebhard|LINK
A web site is just an HTTP service; one request, one response. It is up to you to design and write the background task logic. Keep in mind, web application are not good candidates for running background tasks. Web applications spin down after non use which will stop the background task unexpectedly.
https://docs.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/
An application pool defines a group of one or more worker processes, configured with common settings that serve requests to one or more applications that are assigned to that application pool. Because application pools allow a set of Web applications to share one or more similarly configured worker processes, they provide a convenient way to isolate a set of Web applications from other Web applications on the server computer. Process boundaries separate each worker process; therefore, application problems in one application pool do not affect Web sites or applications in other application pools. Application pools significantly increase both the reliability and manageability of your Web infrastructure.
Participant
1861 Points
2836 Posts
Re: Good resource to best utilize IIS
Apr 26, 2020 02:11 AM|EnenDaveyBoy|LINK
have you thought about using Azure functions or Amazon AWS?