Programmatically Administering the Web Performance Property Sheet

   

Programmatically Administering the Web Performance Property Sheet

There are several properties IIS uses to tune memory allocation, bandwidth usage, and connection behavior to your specifications (see Figure 9.4).

Figure 9.4. Default Web Site Properties Configuration dialog box ”Performance tab.

graphics/09fig04.gif

Additionally, you can enable "HTTP keep-alives" to allow clients to maintain open connections to the server. This option eliminates the overhead associated with connection instantiation and tear down for each request.

In this section, you will explore the programmatic methods behind each of these configurable options.

Performance Tuning

By adjusting the Performance Tuning slider control you are actually modifying the amount of memory allocated to operate the specific site. Incorrect configuration of this option results in wasted memory resources or poor performance at the client. If your site receives significantly more hits than the number specified by this property, performance could potentially improve by allocating more memory to the site. If the site receives fewer hits than the number specified by this property, too much memory is allocated to the site. Use the logs of the live site to analyze the performance of your site and configure this setting accordingly .

Using the ServerSize property of the IIsWebServer object, you can set this value programmatically. The ServerSize property uses an integer datatype to define this property and assigns the following values to each integer, as shown in Table 9.2.

Table 9.2. ServerSize Integer Values, Settings, and Descriptions
Integer Value Setting Description
Small Site Fewer than 10,000 requests served daily by this site
1 Medium Site Between 10,000 and 100,000 requests served daily by this site
2 Large Site More than 100,000 requests served daily by this site
Querying ServerSize Using Visual Basic

To find out the current ServerSize property configuration of the bound site, use the following Visual Basic code:

 Dim Site As IADs Dim ServerName As String Dim SiteIndex As Long ServerName = "IIS_Server_Name" SiteIndex = Site_Index_Value Set Site = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) Debug.Print Site.ServerSize 
Setting ServerSize Using Visual Basic

To specify a new value for the ServerSize property, use Table 9.2 and the following Visual Basic code:

 Dim Site As IADs Dim ServerName As String Dim SiteIndex As Long Dim NewServerSize As Integer ServerName = "IIS_Server_Name" SiteIndex = Site_Index_Value NewServerSize = 0 Set Site = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) Site.ServerSize = NewServerSize Site.SetInfo 

Enable Bandwidth Throttling

Just as you can manipulate the maximum bandwidth for the entire server, you can also manipulate individual sites by binding to the desired site, and then modifying/querying the MaxBandwidth property.

In certain cases, you may wish to allocate a larger percentage of available bandwidth to a specific site. This is useful when a preview and subscription site exist on the same server, or perhaps for testing purposes to determine the performance at a given transfer rate.

Querying Maximum Bandwidth for a Site Using Visual Basic

To find the current value for the MaxBandwidth property, use the following Visual Basic code:

 Dim Site As IADs Dim ServerName As String Dim SiteIndex As Long ServerName = "IIS_Server_Name" SiteIndex = Site_Index_Value Set Site = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) Debug.Print Site.MaxBandwidth 
Setting Maximum Bandwidth for a Site Using Visual Basic

To set a new value in bytes for the MaxBandwidth property, use the following Visual Basic code:

 Dim Site As IADs Dim ServerName As String Dim SiteIndex As Long Dim NewMaxBandwidth As Long ServerName = "IIS_Server_Name" SiteIndex = Site_Index_Value NewMaxBandwidth = Value_in_Bytes Set Site = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) Site.MaxBandwidth = NewMaxBandwidth Site.SetInfo 

Connection Configuration

By default, IIS uses HTTP keep-alives to minimize the overhead associated with creating and destroying HTTP sessions for every request. Using the AllowKeepAlive property of the IIsWebServer object, you can disable or enable the use of HTTP keep-alives for a particular site. By reducing connection instantiation and destruction for each request, HTTP keep-alives will often increase performance of the site.

Querying HTTP Keep- Alive Processing Status Using Visual Basic

To find the current status of HTTP keep-alive processing, use the following Visual Basic code:

 Dim Site As IADs Dim ServerName As String Dim SiteIndex As Long ServerName = "IIS_Server_Name" SiteIndex = Site_Index_Value Set Site = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) Debug.Print Site.AllowKeepAlive 
Setting HTTP Keep-Alive Processing Status Using Visual Basic

To enable or disable HTTP keep-alive processing, use the following Visual Basic code:

 Dim Site As IADs Dim ServerName As String Dim SiteIndex As Long Dim AllowKeepAlive As Boolean ServerName = "IIS_Server_Name" SiteIndex = Site_Index_Value AllowKeepAlive = True Set Site = GetObject("IIS://" & ServerName & "/W3SVC/" & SiteIndex) Site.AllowKeepAlive = AllowKeepAlive Site.SetInfo 

   
Top


Windows NT. 2000 ADSI Scripting for System Administration
Windows NT/2000 ADSI Scripting for System Administration
ISBN: 1578702194
EAN: 2147483647
Year: 2000
Pages: 194
Authors: Thomas Eck

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net