xref: /aosp_15_r20/external/curl/docs/cmdline-opts/rate.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: rate
5*6236dae4SAndroid Build Coastguard WorkerArg: <max request rate>
6*6236dae4SAndroid Build Coastguard WorkerHelp: Request rate for serial transfers
7*6236dae4SAndroid Build Coastguard WorkerCategory: connection global
8*6236dae4SAndroid Build Coastguard WorkerAdded: 7.84.0
9*6236dae4SAndroid Build Coastguard WorkerMulti: single
10*6236dae4SAndroid Build Coastguard WorkerScope: global
11*6236dae4SAndroid Build Coastguard WorkerSee-also:
12*6236dae4SAndroid Build Coastguard Worker  - limit-rate
13*6236dae4SAndroid Build Coastguard Worker  - retry-delay
14*6236dae4SAndroid Build Coastguard WorkerExample:
15*6236dae4SAndroid Build Coastguard Worker  - --rate 2/s $URL ...
16*6236dae4SAndroid Build Coastguard Worker  - --rate 3/h $URL ...
17*6236dae4SAndroid Build Coastguard Worker  - --rate 14/m $URL ...
18*6236dae4SAndroid Build Coastguard Worker---
19*6236dae4SAndroid Build Coastguard Worker
20*6236dae4SAndroid Build Coastguard Worker# `--rate`
21*6236dae4SAndroid Build Coastguard Worker
22*6236dae4SAndroid Build Coastguard WorkerSpecify the maximum transfer frequency you allow curl to use - in number of
23*6236dae4SAndroid Build Coastguard Workertransfer starts per time unit (sometimes called request rate). Without this
24*6236dae4SAndroid Build Coastguard Workeroption, curl starts the next transfer as fast as possible.
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerIf given several URLs and a transfer completes faster than the allowed rate,
27*6236dae4SAndroid Build Coastguard Workercurl waits until the next transfer is started to maintain the requested
28*6236dae4SAndroid Build Coastguard Workerrate. This option has no effect when --parallel is used.
29*6236dae4SAndroid Build Coastguard Worker
30*6236dae4SAndroid Build Coastguard WorkerThe request rate is provided as "N/U" where N is an integer number and U is a
31*6236dae4SAndroid Build Coastguard Workertime unit. Supported units are 's' (second), 'm' (minute), 'h' (hour) and 'd'
32*6236dae4SAndroid Build Coastguard Worker/(day, as in a 24 hour unit). The default time unit, if no "/U" is provided,
33*6236dae4SAndroid Build Coastguard Workeris number of transfers per hour.
34*6236dae4SAndroid Build Coastguard Worker
35*6236dae4SAndroid Build Coastguard WorkerIf curl is told to allow 10 requests per minute, it does not start the next
36*6236dae4SAndroid Build Coastguard Workerrequest until 6 seconds have elapsed since the previous transfer was started.
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard WorkerThis function uses millisecond resolution. If the allowed frequency is set
39*6236dae4SAndroid Build Coastguard Workermore than 1000 per second, it instead runs unrestricted.
40*6236dae4SAndroid Build Coastguard Worker
41*6236dae4SAndroid Build Coastguard WorkerWhen retrying transfers, enabled with --retry, the separate retry delay logic
42*6236dae4SAndroid Build Coastguard Workeris used and not this setting.
43*6236dae4SAndroid Build Coastguard Worker
44*6236dae4SAndroid Build Coastguard WorkerStarting in version 8.10.0, you can specify number of time units in the rate
45*6236dae4SAndroid Build Coastguard Workerexpression. Make curl do no more than 5 transfers per 15 seconds with "5/15s"
46*6236dae4SAndroid Build Coastguard Workeror limit it to 3 transfers per 4 hours with "3/4h". No spaces allowed.
47