Open2

GCS の 階層型名前空間による性能向上を調査する

Yuji TsuritaniYuji Tsuritani

gcloud コマンドでバケットを作成する

hierarchical-namespace 無効

gcloud storage buckets create /
gs://test-gcs-no-hrcl-performance --location=us-east1 /
--uniform-bucket-level-access

hierarchical-namespace 有効

gcloud storage buckets create /
gs://test-gcs-hrcl-performance --location=us-east1 /
--uniform-bucket-level-access --enable-hierarchical-namespace

gcloud コマンドでフォルダを作成する

gcloud storage folders create --recursive /
gs://test-gcs-hrcl-performance/folder1/subfolder1/subsubfolder1/github_timeline

public dataset からファイルをエクスポートする(時間を測定する)

source table: bigquery-public-data.samples.github_timeline

フォルダなし検証1

destination: gs://test-gcs-no-hrcl-performance/folder1/subfolder1/subsubfolder1/github_timeline/
合計論理バイト数 3.54 GB

time bq extract --destination_format=CSV /
bigquery-public-data:samples.github_timeline /
"gs://test-gcs-no-hrcl-performance/folder1/subfolder1/subsubfolder1/github_timeline/github_timeline*.csv"

1.21s user 0.29s system 7% cpu 20.271 total

フォルダあり検証1

destination: gs://test-gcs-hrcl-performance/folder1/subfolder1/subsubfolder1/github_timeline/

time bq extract --destination_format=CSV /
bigquery-public-data:samples.github_timeline /
"gs://test-gcs-hrcl-performance/folder1/subfolder1/subsubfolder1/github_timeline/github_timeline*.csv"

1.19s user 0.30s system 7% cpu 20.028 total

gcloud コマンドでフォルダを作成する

gcloud storage folders create --recursive /
gs://test-gcs-hrcl-performance/folder1/subfolder1/subsubfolder1/wikipedia

フォルダなし検証2

destination: gs://test-gcs-no-hrcl-performance/folder1/subfolder1/subsubfolder1/wikipedia/
合計論理バイト数 35.69 GB

time bq extract --destination_format=CSV /
bigquery-public-data:samples.wikipedia /
"gs://test-gcs-no-hrcl-performance/folder1/subfolder1/subsubfolder1/wikipedia/wikipedia*.csv"

1.13s user 0.26s system 12% cpu 11.156 total

フォルダあり検証2

destination: gs://test-gcs-hrcl-performance/folder1/subfolder1/subsubfolder1/wikipedia/

time bq extract --destination_format=CSV /
bigquery-public-data:samples.wikipedia /
"gs://test-gcs-hrcl-performance/folder1/subfolder1/subsubfolder1/wikipedia/wikipedia*.csv"

1.14s user 0.26s system 11% cpu 12.642 total

結果

特に速度が向上しているという結果にならない。

フォルダ ファイル数 合計論理バイト数 時間
フォルダなし検証1 36 3.54 GB 20.271s
フォルダあり検証1 36 3.54 GB 20.028s
フォルダなし検証2 501 35.69 GB 11.156s
フォルダあり検証2 501 35.69 GB 12.642s
Yuji TsuritaniYuji Tsuritani
  • 検証方法が適切なのか。
  • 公式ページにメリットとして記載されている部分のユースケースの解釈が合っているのか。