Seb*_*Seb 1 google-cloud-storage gsutil
我在一个带有25个4gb json文件的目录上并行运行gsutil cp命令(使用-m选项)(我也使用-z选项进行压缩).
gsutil -m cp -z json -R dir_with_4g_chunks gs://my_bucket/
Run Code Online (Sandbox Code Playgroud)
当我运行它时,它将打印到终端,它正在复制除了其中一个文件之外的所有文件.我的意思是它每个文件打印其中一行:
Copying file://dir_with_4g_chunks/a_4g_chunk [Content-Type=application/octet-stream]...
Run Code Online (Sandbox Code Playgroud)
一旦完成其中一个的传输,它就会说它将复制最后一个文件.
结果是有一个文件只在其中一个文件完成复制时才开始复制,从而大大减慢了进程
我可以使用-m选项上传的文件数量是否有限制?这可以在boto配置文件中配置吗?
从-m选项的描述:
gsutil使用多线程和多处理的组合执行指定的操作,使用由boto配置文件中设置的parallel_thread_count和parallel_process_count值确定的多个线程和处理器.您可能希望尝试使用这些值,因为最佳值可能会因许多因素而异,包括网络速度,CPU数量和可用内存.
如果您查看.boto文件,您应该会看到此生成的注释:
# 'parallel_process_count' and 'parallel_thread_count' specify the number
# of OS processes and Python threads, respectively, to use when executing
# operations in parallel. The default settings should work well as configured,
# however, to enhance performance for transfers involving large numbers of
# files, you may experiment with hand tuning these values to optimize
# performance for your particular system configuration.
# MacOS and Windows users should see
# https://github.com/GoogleCloudPlatform/gsutil/issues/77 before attempting
# to experiment with these values.
#parallel_process_count = 12
#parallel_thread_count = 10
Run Code Online (Sandbox Code Playgroud)
我猜你是在Windows或Mac上,因为非Linux机器的默认值是24个线程和1个进程.这将导致首先复制24个文件,然后复制最后1个文件.尝试尝试增加这些值以一次传输所有25个文件.
我无法在Mac上找到.boto文件(根据上面的jterrace的回答),而是使用-o开关指定了这些值:
gsutil -m -o "Boto:parallel_thread_count=4" cp directory1/* gs://my-bucket/
Run Code Online (Sandbox Code Playgroud)
这似乎控制了转移率.
| 归档时间: |
|
| 查看次数: |
3072 次 |
| 最近记录: |