A Brief Introduction to IIS
IIS is a web server that runs on the Microsoft .NET platform on the Windows OS. While it’s possible to run IIS on Linux and Macs using Mono, it’s not recommended and will likely be unstable. (There are other options, which I’ll present later). It’s versatile and stable, and it’s been widely used in production for many years. Version 10 is the most current.
There are several versions of IIS Server, each tied to the corresponding version of the operating system. Three of the Microsoft IIS servers are IIS 6 in Windows 2003, IIS7 in Windows 2008,IIS 7.5 in Windows 2008 R2,IIS 8.0 in Windows 2012 and IIS 8.5 in Windows 2012 R2.
Microsoft IIS server is the most used web server after the Apache HTTP Server.
Performance Tips for IIS
Server performance is linked with the number of requests that a server can handle at a time and the time required for processing these requests. Many factors, including hardware, other applications running on the same computer, network bandwidth and other elements, impact IIS 7.0 performance. These performance tips are broadly classified into:
- Application Based
- Software Based
- Feature Based
In this article, we will cover application based performance tips for IIS servers.
Application Based Performance Tips
The following tuning tips, based on the applications running on IIS, can help administrators with IIS management and optimize the performance of IIS.
1. Remove competing applications and services
In order to provide the user with the best possible performance, IIS must have the necessary hardware resources: CPU, disk and memory. Basic IIS monitoring will indicate whether the resources necessary are available.
Other applications and services on the same computer may consume those resources and negatively impact IIS web server performance.
To free up hardware resources, use IIS server monitoring and check to see if the other applications or services are left idle and unused. If so, uninstall the unused applications and services.
However, if the other applications and services are actively used, move them to another computer to free up resources for IIS server.
2. Optimize content usage
Content published on a server directly affects its response. One of the benefits of Microsoft IIS server is that it can handle both static and dynamic content.
The advantage of static content over dynamic contact is that static contact is directly served upon the client request, whereas dynamic content needs to be processed before passing it to the client. The processing required for dynamic content results in a resource burden on the IIS server.
Whenever possible, avoid using dynamic content and utilize static content to provide better performance.
3. Limit the queue length for application pools
When running an IIS server in worker process isolation mode, limit the queue length for application pools to prevent large numbers of requests from queuing and overloading the IIS web server.
Adding a new request to the queue can result in exceeding the maximum queue length. In turn, the IIS server may reject the requests and send a 503 error to the client. Keep the queue length shorter to boost IIS performance.
4. IIS HTTP compression
Enable HTTP compression on the Microsoft IIS server to use bandwidth more effectively. This results in faster response times between the IIS web server and compression-enabled browsers.
IIS can provide three compression options, including static files only, dynamic application responses, and both static and dynamic application responses.
Enable dynamic compression for the server when bandwidth is an issue as indicated by IIS server monitoring, but remember that compression consumes CPU time and memory resources significantly.
5. Grow a Web Garden on IIS
The configuration of two or more worker processes as a part of an application pool forms a web garden. A web garden allows for more scalability in an application because multiple processes are used to process requests on the application’s behalf.
A web garden increases performance of the IIS server, especially when there are memory constraints or leaky applications. Creating a web garden on a multiprocessor system boosts application response time on the server. However, when using any session variables, make sure to run out-of-process session management.
Out of process session management is necessary because all worker processes inside the web garden do not share memory space. Having an in-process session management will result in losing session details if the request was previously handled by other worker process.
6. Recycling application pools
This tip applies specifically to Microsoft IIS server 6. Application pools are used to isolate web applications for better security, reliability, and availability and performance and to keep the web applications running without them impacting each other. It separates sets of IIS worker processes that share the same configuration and application boundaries.
Recycling application pools means recycling the worker processes and the memory used for the web application.
You can configure the Microsoft IIS server to periodically restart worker processes under certain conditions, which is required to avoid memory problems.
After recycling an application pool, memory resources on IIS are released until the next request for an application in that pool is received. As a result, the WWW service shuts down all running worker processes that are serving the application pool and starts new worker processes.
7. Logging frequency
Logging too much information affects IIS server performance. Set IIS to log as little information as possible for normal, day-to-day utilization. If there are issues with a site or web server, turn up the logging level to include failed request tracing. In this case, simple IIS management can create better results.
In order to enabled the failed request tracing feature in IIS Manager, follow these steps:
- Select the website to be enabled for failed request tracing
- In the Actions pane, click Failed Request Tracing to bring up the Edit Web Site Failed Request Tracing Settings dialog box, shown below.
- Click the Enable box and select the directory to create the log files and the maximum number of trace files desired. For best results, move the log file creation to a separate volume; otherwise, logging files will hog space on the system drive.
To configure other day-to-day logging, use the Logging applet to set the following items:
- Log file rollover
8. Use the Expires header in IIS7
Configure the HTTP Expires header to improve IIS server performance. Generally, continuous HTTP requests sent from new website visitors to display pages creates a massive load on the IIS server.
Configuring the Expires header allows caching pages (and page elements such as images, scripts, css, etc.) on the client side and helps avoid unnecessary HTTP requests.
In IIS 7, Expires headers can be enabled in the system.webServer section of the web.config file. Using the Expires header, you can determine how long files can be cached on the client side. This may be a certain number of hours or days in the future or a fixed date.
Use these application based performance tips to improve IIS server performance. In our next article, we will cover software based tips to make IIS management easier.
If you have any questions feel free to contact me on firstname.lastname@example.org also follow me on facebook @windowstechno to get updates about new blog posts.