All Products
Search
Document Center

CDN:Throttling functions

Last Updated:Apr 01, 2026

Use limit_rate_after and limit_rate together to control the data transfer rate for individual CDN requests. Both functions apply per-request — they do not control global bandwidth.

limit_rate_after

Sets the maximum amount of data transfer before throttling begins.

ItemDetails
Syntaxlimit_rate_after(n, unit)
Return valuetrue on success, false on failure

Parameters

ParameterTypeRequiredDescription
nintegerYesMaximum data transfer before throttling begins. If unit is omitted, n is in bytes.
unitcharNoUnit for n. Valid values: K, M, G (case-insensitive).

limit_rate

Sets the rate to which data transfer is throttled after the limit_rate_after threshold is reached.

The minimum enforced rate is 50 KB/s. If you specify a lower value, the rate is throttled to 50 KB/s.
ItemDetails
Syntaxlimit_rate(n, unit)
Return valuetrue on success, false on failure

Parameters

ParameterTypeRequiredDescription
nintegerYesThrottled data transfer rate. If unit is omitted, n is in bytes per second.
unitcharNoUnit for n. Valid values: K, M, G (case-insensitive).

Example

Use limit_rate_after and limit_rate together to let a request transfer data at full speed up to a threshold, then cap the rate:

limit_rate_after(100, 'k')
limit_rate(1, 'm')
// The first 100 KB transfers at full speed. After that, the rate is capped at 1 MB/s.