Throttling gsutil

Throttling gsutil


Particularly when used with the -m (multi-threading) option, gsutil can consume a significant amount of network bandwidth. In some cases this can cause problems, for example if you start a large rsync operation over a network link that's also used by a number of other important jobs.

While gsutil has no built-in support for throttling requests, there are various tools available on Linux and MacOS that can be used to throttle gsutil requests.

One tool is trickle (available via apt-get on Ubuntu systems), which will let you limit how much bandwidth gsutil consumes. For example, the following command would limit upload and download bandwidth consumed by gsutil rsync to 100 KBps:

trickle -d 100 -u 100 gsutil rsync -r ./dir gs://some bucket

Note that we recommend against using the -m flag with gsutil when running via trickle, as this may cause resource starvation and prevent your command from finishing.

Another tool is ionice (built in to many Linux systems), which will let you limit how much I/O capacity gsutil consumes (e.g., to avoid letting it monopolize your local disk). For example, the following command would reduce I/O priority of gsutil so it doesn't monopolize your local disk:

ionice -c 2 -n 7 gsutil -m rsync -r ./dir gs://some bucket

Send feedback about...

Cloud Storage Documentation