# Implementing IIS Web Gardens

Part of the Performance and Scaling series.

Internet Information Services (IIS) is the server technology that Exago runs on in Windows. When you install Exago BI, IIS assigns it to an application pool (app pool), which is an isolated set of processes and memory. Applications are isolated for two reasons: security, as each app pool has its own set of configurable permissions; and reliability, since one crashed or halting pool will not affect the other pools.

By default, app pools each run on a single worker process. However, if Exago BI is running on a dedicated server, there can be performance benefits to increasing the number of worker processes per app pool. An app pool running on multiple worker processes is known as a web garden or a single-server web farm. Using a web garden allows you to make optimal use of the CPU and RAM, and decrease the amount of idle resources.

There are three steps involved with configuring Exago BI to run in a web garden: Enabling a State Service, turning on the Web Farm Support config flag, and increasing the Maximum Worker Processes app pool setting.

# 1. Enabling a State Service

Since Exago BI is a stateful web application, in order to use a web garden you need to set up a state service to route incoming requests to the correct worker process.

## Background

When a user enters the application, they are assigned a collection of session data that the application needs to make any further requests. This session data consists of user-specific settings and parameters, as well as temporary data related to the application usage. Each worker process is essentially its own "copy" of the application, with an isolated set of memory. When a session is created, it is assigned to one worker process, so all subsequent requests need to reach that same process in order to be able to access the session data. A state service ensures that sessions are routed correctly when there are multiple worker processes in use.

## Setup

This guide discusses using the ASP.NET State Service, which is native to Windows Server. However, a third party solution can be used if desired. An external server could also be used to manage session state; this is typically done in a multi-server web farm, and it is usually unnecessary for a web garden.

To enable and configure the ASP.NET State Service on the Exago web server:

### Enable the ASP.NET State Service

1. Click Start > Run, or press Win+R, to open the Run dialog.
2. Type `services.msc`, then press Enter.
3. Locate ASP.NET State Service. Right-click it, then click Properties.
4. From the Startup Type list, select Automatic.
5. Click Start.
6. Click OK. Verify that "Running" appears in the Status column for this service.

### Configure Exago BI to use the State Service

By default, the ASP.NET State Service listens on port 42424. To check what port it is listening on:

1. Press Ctrl+Shift+Esc to open the Task Manager.
2. Click the Details tab.
3. Locate aspnet_state.exe and record the number in the PID column.
4. Click Start > Run, or press Win+R, to open the Run dialog.
5. Type `cmd`, then press Enter.
6. Type `netstat -a -n -o | FINDSTR PID`, where PID is the number from step 3. Then press Enter. This will show the list of running TCP applications.
7. Locate the line with the PID in the right most column. In the second column locate and record the port number, which appears after the colon in 127.0.0.1:
   Example
   `TCP 127.0.0.1:42424 0.0.0.0:0 LISTENING 76`

Next, configure the Exago BI application to use the state service:

1. Open the Internet Information Services (IIS) Manager.
2. In the left-most Connections pane, select the Exago application.
3. In the center Home pane, double-click the Session State icon.
4. Click State Server.
5. In the Connection String field, type `tcpip=loopback:port`, where port is the port number that the state service is listening on. The other settings can be configured as desired.
6. In the right-most Actions pane, click Apply.

# 2. Web Farm Support

A flag needs to be set in the Exago BI configuration file to enable web farm support. This cannot be done in the Administration Console. To do so:

1. Open the Exago BI configuration file (default is Config/WebReports.xml) in a text or XML editor.
2. Locate and set the <webfarmsupport> flag to `True`:
   `<webfarmsupport>True</webfarmsupport>`
3. Restart the Exago BI application in IIS.

# 3. Maximum Worker Processes

With the first two steps completed, you can safely set the app pool to use multiple worker processes.

First, verify the app pool that Exago BI is running on:

1. Open the Internet Information Services (IIS) Manager.
2. In the left-most Connections pane, right-click the Exago application, then click Manage Application > Advanced Settings.
3. Record the value for Application Pool.

Next, change the app pool settings:

1. In the left-most Connections pane, click Application Pools.
2. In the center Application Pools pane, locate the app pool that Exago BI is running on.
3. Right-click the app pool, then click Advanced Settings.
4. Enter a value for Maximum Worker Processes to a number greater than 1.
5. Click OK.

We recommend experimenting in order to determine the optimal number of worker processes for your server that maximizes the amount of CPU and memory used without overworking the CPU or thrashing the virtual memory.

Additional resources:

IIS Documentation

Web gardening in IIS 7, configure step by step - TechNet Articles - United States (English) - TechNet Wiki