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.