Virtual Host-Level Bandwidth Throttling

LiteSpeed Web Server version 5.0 introduces virtual host-level bandwidth throttling. This can be thought of as an extension of LSWS's Per Client Throttling settings, which allow you to control the amount of stress a single IP can put on your server. Virtual host-level bandwidth throttling allows you to customize bandwidth throttling, in Apache configs, for particular virtual hosts. You can now set up stricter settings for sites that you know are targets or more lenient settings for sites that might require a lot of bandwidth going to one IP. (This has been available for some time in vhosts with LSWS-native configs.) It also allows for throttling bandwidth by file type and size.

Configuration

LSWS's implementation of this bandwidth throttling follows syntax similar to that used by Apache’s mod_bw. Bandwidth throttling directives can only be placed in virtual host configuration file, not an .htaccess file.

Note: LSWS simply lowers bandwidth as users get close to limits. It does not return error pages.

Directives

BandWidth

Syntax:

BandWidth [Origin] [Speed in bytes/s]

The BandWidth directive controls the amount of bandwidth allotted to specific users. It takes 2 parameters:

  • Origin is the origin of the connections. It can be a single IP address, a set of IP addresses, a network mask, or all.
  • Speed indicates the total speed available to the Origin. If Speed is 0, there is no limit.

MinBandWidth

Syntax:

BandWidth all [Speed in bytes/s]
MinBandWidth all -1

LSWS only supports one use of MinBandWidth: MinBandWidth all -1. When used in conjunction with the BandWidth directive (as above), this specifies the top speed for all clients.

LargeFileLimit

Syntax:

LargeFileLimit [Type] [Minimum Size in kilobytes] [Speed in bytes/s]

The LargeFileLimit directive allows you to throttle the bandwidth that certain large files use. It takes three parameters:

  • Type is the suffix of files to be throttled. * can be used to designate all files.
  • Minimum Size tells the server the size of files to be throttled.
  • Speed indicates the maximum speed at which these files can be served.

Examples

BandWidth all 102400

The above setting would limit the total bandwidth allowed to this virtual host to 100KB/s

BandWidth all 50000
MinBandWidth all -1
LargeFileLimit .avi 500 10240

The above settings limit each client to 50KB/s with no maximum total bandwidth. .avi files of 500KB or greater, though, are limited to 10KB/s.

 
litespeed_wiki/config/vhost-level_bw_throttling.txt · Last modified: 2016/07/25 13:27 by Long Hu