Bandwidth throttling by username or client IP address


Overview

This section provides information about throttling bandwidth by username or client IP address. This functionality is included as part of the standard Zeus Web Server, but is enabled only when a license key containing the "bandwidth throttle by user" flag is installed.

This powerful functionality allows you to designate a specific quality of service for each individual client. You could ensure that each client is permitted a total connection speed of no more than 128 Kbit/s (or whatever you choose), regardless of whether that client has a single HTTP connection to your site, or many, as when using a Download Manager. Client bandwidth throttling in this way has saved hosting companies many tens of thousands of dollars on their bandwidth costs.

The bandwidth throttling by username or IP address functionality is not documented in the main Zeus User Guide. This page documents the facilities, tunables and clustering abilities available.

Purchasing

Enabling client bandwidth throttling functionality is simply a case of deploying a new license key through your Admin Server. You will not need to reinstall your copy or copies of Zeus Web Server, though it should be noted that this functionality is only available from Zeus Web Server version 4.2 onwards.

To take advantage of this powerful functionality, please contact your account manager, or email sales@zeus.com. Alternatively, please call +44 (0)1223 568555 for pricing and availability.

Configuration

Authentication

To enable bandwidth throttling on a per-user basis, the throttle module needs to be able to determine the identity of a particular client request. This can be done automatically by using standard basic authentication techniques, e.g. access control using one of the access control modules such as htaccess, or this user identity information can be passed to the throttle module from a cookie, or a portion of the URL requested or from other information in the client's HTTP request, by appropriate configuration of the rewrite module.

If no user authentication details are available, and the useip tunable is enabled, then requests from this client IP address will be treated as a user, and limited in the bandwidth which is allowed. If the tunable is disabled, and user authentication details are not available, then bandwidth is not limited.
Enabling throttling by user

There is currently no GUI available for the bandwidth throttling by username. To enable, you will need to edit your virtual server configuration file with a text editor. Your config file is located at $ZEUSHOME/webadmin/conf/virtual_servers/site/<yoursite>. To enable throttling for users, you will need to set the following keys:

modules!throttle!policy user

User throttling is only performed when the policy is set to "user". To revert to throttling on a per-virtual server basis, delete the policy key.

The tunables for user throttling are listed below:

Tunable Description
modules!throttle!user!cluster_aware boolean enable writing/reading of cluster quotas to disk
modules!throttle!user!limit int limit in bytes/sec for a specific user/IP address (default 128000)
modules!throttle!user!mimetypes type,type mimetypes to enable user throttling for
modules!throttle!user!minfilesize int minimum filesize to enable user throttling for
modules!throttle!user!useip boolean use client IP address to throttle instead if no username is available (default no)
modules!throttle!user!expirytime int time to purge users after, in seconds (default 10 seconds)
modules!throttle!user!flushtime int time to write out user data (default 30 seconds)
modules!throttle!user!updatetime int time to recalculate bandwidth, in milliseconds (default 500)
modules!throttle!user!statsdir dir directory to write out statistics periodically
modules!throttle!user!quotafile file filename to read throttle quotas to periodically

Enforcing bandwidth across a cluster

It is possible to enforce bandwidth allocations for a user across a cluster. This is achieved using some disk space which is shared using NFS (or another network file system) between each server in the cluster.

Periodically, a file is written by each server which details the bandwidth usage of each user requesting files from this server. These files are collected by the $ZEUSHOME/webadmin/bin/aggregate_quotas.pl script, and the overall bandwidth is calculated. This is the maximum bandwidth allowed divided by the number of servers they have connections open to. It is assumed that if a user is requesting a file from a server, their full bandwidth is being utilised. Each server reads the new bandwidth allocation file periodically and adjusts the rate at which it serves files to the user.

The tunable:

modules!throttle!user!cluster_aware 

determines whether to enable bandwidth throttling across a cluster. The tunable:

modules!throttle!user!statsdir 

specifies into which directory to write the statistics for each user. These are written in the form "stats.hostname.pid", using the IP address of the server if the hostname is unavailable. The tunable:

modules!throttle!user!quotafile 

determines where to read the aggregated bandwidth allocations from. This is likely to be on the same shared NFS disk that statistics are written to. Finally, the 'flushtime' tunable determines how often aggregated bandwidth allocation should occur. If a large number of users are anticipated to be requesting files then a longer time between recalculations should be used. 30 seconds is the default and is suitable for most uses. The aggregated bandwidth calculation applies to the server, so that if a user has multiple connections to a server, then the bandwidth is shared between each connection.

CPU usage

The user throttling functionality requires minimal amounts of CPU to throttle a large number of users. The usage is linear to the number of users who are currently making HTTP requests. Each user's allocation is recalculated periodically, defined the by updatetime tunable. The default is to recalculate every 0.5 seconds. Increasing this tunable will mean less CPU is used recalculating bandwidth, but each user's allocation may be less smooth.

Content Manager [Administrator] 02 February 2006  Permalink  
Leave a comment ...
Your email address will not be displayed.
Your URL will be displayed.
This public messageboard is not a forum for technical support. To report technical support problems, please contact our dedicated Support team using the instructions at the bottom of this page.
Options:
 
(Line breaks become <br />)
(Set cookies for name, email & url)
Download Free Trial

Recent Articles

Other Resources



www.zeus.com