Tuesday, March 18, 2008 2:58 PM
Bit Rate Throttling for IIS7 & Connection Limit Groups
The recent release of the Bit Rate Throttling Module for IIS provides some useful and compelling features for managing response rates for data and media files. One of the interesting features that is included is the notion of a connection limit group. While IIS (via HTTP.SYS) provides a mechanism for limiting the concurrent connections for an entire site (see Advanced Settings in the UI), our Bit Rate Throttling module goes a step further, allowing admins to define and configure their own connection limits, grouped according to file type (based on file extension) or mime-type (based on the content-type response header).
Connection limit groups take some explaining, and are more of an advanced feature, and as such are not exposed via the UI (at least not yet!). Taking a peek at applicationHost.config after installing BRT, you’ll see the following settings (note that I have pruned these to fit nicely in a painfully narrow blog window):
<add fileExtension=".asf" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".avi" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".flv" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".mov" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".mp3" … connectionLimitGroup="AudioFiles" />
<add fileExtension=".mp4" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".m4v" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".rm" … connectionLimitGroup="AudioFiles" />
<add fileExtension=".rmvb" … connectionLimitGroup="VideoFiles" />
<add fileExtension=".wma" … connectionLimitGroup="AudioFiles" />
<add fileExtension=".wmv" … connectionLimitGroup="VideoFiles" />
<add name="VideoFiles" connectionLimit="0" />
<add name="AudioFiles" connectionLimit="0" />
You'll notice that each file extension rule associates, by name, a connection limit group with it (e.g. connectionLimitGroup="VideoFiles"). Later on in applicationHost.config we see the definitions for a connection limit group, each of which has simply a unique name and a connection limit defined (zero implies no limit). This allows administrators to have very custom and granular control over which responses should have limits associated with them. A likely scenario would be when you don't want simultaneous downloads for large video files to monopolize your available throughput. By limiting the number of connections available for video files (be they .wmv or .flv or whatever) you can effect control over how much bandwidth is allocated for that particular group of connections. A connection limit as defined above specifies the maximum number of concurrent connections allowed. If the connectionLimit for a particular group were set to "10" and 10 clients were each downloading a file whose type belonged to the same group, the 11th client (requesting the same type of file) would receive a 503 Response from the server.
There is a deliberate separation / independence between a throttling rule and a connection limit group. Both file extension rules and mime type rules (not seen in the above config) can specify this attribute. In all likelihood you'd need only a few connection limit groups, but their number, naming and limits are completely configurable – in theory each throttling rule could have its own. The example included with the default install illustrates a scenario where you wish to manage the # of connections based on whether a response originates from an audio or video file. The concept applies equally well to data rules, where you might want to limit the # of simultaneous downloads of large files. Presently there is no way to group and to limit responses which don't fall into one of the rules specified in the configuration (how would we know which connection limit group to add it to?).
The connectionLimitGroup attribute is optional, as is the connectionLimitGroups collection, so removing them from your config file won't cause an error. However, the UI does not yet support creating or modifying these rules. It may be handy to leave them in, so that should they become appealing in the future you won't have to dig through the schema to recall the exact syntax.
Also interesting is that a connection limit group may specify not only a "connectionLimit" but also a "targetThroughputRateKbps"! This means that responses belonging to a certain connection limit group can be throttled dynamically to stay at a target transfer rate (cumulative value). The idea here is to throttle only when necessary, and to maintain as best as possible a target throughput (hence the name ;). Note that by using a targetThroughputRateKbps (also referred to as "dynamic throttling") the Bit Rate Throttling module will never reduce a response's throttle rate below the value determined by the configuration settings. The targetThroughputRateKbps attribute is only ever used to *increase* throttle rates to take advantage of surplus bandwidth, to serve responses more quickly when conditions allow. It is a best-effort on-the-fly calculation that can and will fluctuate with load (remember too that the inital burts [specified by initialBufferTimeSeconds for media rules or initialSendSizeKBytes for data rules] are sent unthrottled!). It is not a hard-limit or maximum.What happens if you specify a targetThroughputRateKbps for both the site and for a connection limit group? In this case the BRT module will respect the lower of the two limits.
For more information on this release of Bit Rate Throttling for IIS 7.0, see:
Tags: Bit Rate Throttling BRT jackfree Jack Freelander connection limit groups