Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm on IIS 7 and .NET 4.0. My understanding is that IIS takes requests and passes them off to ASP.NET worker threads. If all the threads are in use, the request goes into a queue and is processed once a thread becomes available. If the queue goes over a certain size, all new requests get a 503 until there is room in the queue again.

Is there a way to prioritize the order in which queued requests are served? For example, I have consumer traffic and infrastructure traffic coming to the same server. If there are no available threads, I'd like for the consumer requests to be served first, even if they have arrived after infrastructure requests. Basically I want to replace the request queue with a priority queue. Is this possible with IIS?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

There are a bunch of queues that might be involved; I think your description is incomplete.

IIS allows you to specify that particular parts of a site run in different Application Pools, each of which runs in a separate worker process.

Each App Pool has a kernel-mode request queue (defaults to 1000 requests) used to ensure that in the case of a recycled W3WP (worker process) that requests don't get lost, but this also becomes the practical maximum limit for outstanding requests at a given moment.

If this queue fills up, you get a 503.

App frameworks - like .Net or classic ASP - may also implement their own user-mode request queue which runs within the worker process. I don't believe it's possible to prioritize different requests within the framework (unless there's an ASP.Net feature that does this that I'm not familiar with).

If you have a limited number of threads in each process' thread pool, separating apps into (for example) static content and active content app pools can help keep basic work off the thread pool of a busy app process. (Likewise, adding more threads is (arguably) a reasonable approach to this).

share|improve this answer
    
Interesting point about using separate app pools, however that wouldn't work in my case because my app pool loads so much data into memory that two app pools wouldn't fit on one server! –  dan Mar 28 '12 at 14:09
    
You use one for the app logic (active content) and one for the static content (which is typically a couple of tens of megabytes). That way, individual chunks of app logic and static stuff work independently of each other. If every app must load all the stuff you're loading into every app pool, you're right, you're stuffed! (Unless you can find a way of managing your own thread pool) –  TristanK Mar 28 '12 at 23:53
add comment

I don't believe so, but you could have two sites, one for consumer traffic and one for infrastructure traffic, then they'd each have their own queues.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.