locked
Good resource to best utilize IIS RRS feed

  • Question

  • User-1608281605 posted

    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:

    1. 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?
      1. How can we get the status of any background job?
      2. How can we get the number of pending jobs?
    2. If it's a sync request, will that then go before any pending requests?
    3. 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.
    4. What else am I missing?

    ??? - thanks - dave

    Friday, April 3, 2020 3:26 PM

All replies

  • User475983607 posted

    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.

    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...

    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.

    How can we get the number of pending jobs?

    Same as above.  

    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.  

    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. 

    What else am I missing?

    Can you explain the user case for creating the service?

    Friday, April 3, 2020 3:45 PM
  • User-1608281605 posted

    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

    Friday, April 3, 2020 3:54 PM
  • User475983607 posted

    david@windward.net

    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. 

    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.

    Friday, April 3, 2020 4:15 PM
  • User1034446946 posted

    have you thought about using Azure functions or Amazon AWS?

    Sunday, April 26, 2020 2:11 AM