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.
Item | Details |
Syntax |
|
Return value |
|
Parameters
Parameter | Type | Required | Description |
| integer | Yes | Maximum data transfer before throttling begins. If |
| char | No | Unit for |
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.
Item | Details |
Syntax |
|
Return value |
|
Parameters
Parameter | Type | Required | Description |
| integer | Yes | Throttled data transfer rate. If |
| char | No | Unit for |
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.