DCSIMG
10 ways to improve IIS performance - Shai Raiten's Blog

Shai Raiten's Blog

It's all about code...

10 ways to improve IIS performance

10 ways to improve IIS performance

Published On: http://technet.microsoft.com/en-us/magazine/cc160755.aspx

If you want to enhance the performance of your IIS server(s) you can always cluster them or buy more bandwidth. Unfortunately, this tends to be expensive but happily there a number of ways you can improve performance without incurring these high costs.

Individually each of these may do not do much, but combined they could result in major performance gains.

  • Add more memory – To optimize available memory, data is moved back and forth between RAM and disk-based virtual memory. This process is called paging. This process is very inefficient and excessive paging will totally slow down performance. With more RAM in your server, less paging will occur and performance will be improved.
  • Enable HTTP compression – By compressing the pages that IIS is serving performance will be improved. It is important to remember that this can be a trade-off because although it conserves bandwidth, it consumes more CPU time and disk space. Consequently compression is best used on static rather than dynamic pages.
  • Adjust the IIS Object Cache TTL – Every time an object has been requested IIS caches it. Each object is given a time to live (TTL) which by default is 30 seconds. If the pages on your Web site are mostly dynamic this is not really needed, so it is possible to free up some memory by reducing the TTL. A note of warning – the only way of adjusting the TTL is by editing the registry so make sure you have a full system backup beforehand.
  • Adjust connection timeouts – IIS will hold an HTTP connection open while a client downloads multiple files and will then (by default) terminate the connection after 120 seconds of inactivity. Reducing this time out not only frees up more memory (10KB for each connection) but also reduces the potential for denial of service (DoS) attacks. However, bear in mind that 120 seconds may actually be too short for your needs. The only real way to find out what the optimal period is, is to use the Performance monitor to track connections.
  • Enable HTTP keep-alive's – A typical Web page is made up of a number of elements. Enabling HTTP keep-alive's will mean IIS keeps the connection open so the Web browser can download a page made up of different elements without having to remake a connection for each one.
  • Web garden – A Web garden is a way of increasing an application pool’s performance by assigning multiple worker processes to it. A Web garden reduces resource contention.
  • Limit queue length – When IIS receives a request it is placed into a queue until it is serviced. Normally this is not a problem but if the queue gets too long it is probably better to stop new requests until it goes down beneath a preset level. This also has the advantage of stopping your disk being filled up with requests during a DoS attack.
  • Recycle – Web sites with leaky code can seriously impact IIS performance as more memory drains away. A way round this is to recycle the worker processes and memory at the application pool level.
  • Shift priority to the working set – A server running Windows Server 2003 is configured by default to give preference to the file system cache over the working set when allocating memory. But if your server is dedicated to IIS you might see improved performance if you change the priority to the working set instead.
  • Use disk striping – Although not strictly an IIS tweak it will help IIS be more efficient.

 

Comments

kolbis said:

Good work. Dont forget the User Mode versus Kernel Mode optimizations. What are your recommendations regarding the values?

# March 10, 2008 3:45 PM

Shai Raiten said:

Hello Guy,

I don't have a spesific values, each site require their own values, for example connection timeouts:

The only way to determine the optimal timeout period for your server is to use the Performance Monitor to track the Current Connections, Maximum Connections, and Total Connection Attempts counters associated with the Web service performance object. Watch these counters until you have a good idea of the normal values for your organization. Then try incrementally lowering the timeout value, and watching the counters for a few days to see how they are affected. The idea is that you want to find the point at which the Current Connections and Maximum Connections counters reach their lowest average value without driving up the total connection attempts.

But for "Object Cache TTL" I would go for 60 seconds at least. Unless, your site is pure dynamic and content must not be cached.

I'll write a post explaining how to know what is best for "your" IIS, Hope I helped.

# March 10, 2008 5:34 PM

Shai Raiten said:

How To: Improve IIS Performance

# March 13, 2008 1:26 PM

nick_nodelt said:

# June 30, 2009 12:03 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: