Throttling gsutil

Overview

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 -o "GSUtil:parallel_process_count=1" \
  -o "GSUtil:parallel_thread_count=1" 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
本頁內容對您是否有任何幫助?請提供意見:

傳送您對下列選項的寶貴意見...

這個網頁
Cloud Storage
需要協助嗎?請前往我們的支援網頁