Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to get Google Storage bucket size?

I'm currently doing this, but it's VERY slow since I have several terabytes of data in the bucket:

gsutil du -sh gs://my-bucket-1/ 

And the same for a sub-folder:

gsutil du -sh gs://my-bucket-1/folder 

Is it possible to somehow obtain the total size of a complete bucket (or a sub-folder) elsewhere or in some other fashion which is much faster?

like image 328
fredrik Avatar asked Dec 09 '14 08:12

fredrik


People also ask

How do I download a Google bucket file?

In the list of buckets, click on the name of the bucket that contains the object you want to download. The Bucket details page opens, with the Objects tab selected. Navigate to the object, which may be located in a folder. Click the Download icon associated with the object.

What is the Google equivalent of S3 bucket?

Google Cloud Storage is an object storage service that allows you to upload files to a virtual bucket, providing quick and easy file storage for your applications. It competes with AWS's S3 storage service on both price and features.

How fast is Google storage?

Google limits data retrieval to 4MB/sec for every TB stored. The more data you store in Google Cloud Storage Nearline the higher download speed you get., e.g. if you store 5TB you will be able to get you data back at 20MB/s. It will promptly take 73 hours to get the whole data set back.

Are Google buckets free?

There is not a charge for the buckets existing, and the buckets themselves can also be deleted for free (although their may be a charge for deleting some of the objects inside them, such as very new coldline objects). Therefore buckets are very, very cheap for any reasonable number of buckets.


1 Answers

The visibility for google storage here is pretty shitty

The fastest way is actually to pull the stackdriver metrics and look at the total size in bytes: enter image description here

Unfortunately there is practically no filtering you can do in stackdriver. You can't wildcard the bucket name and the almost useless bucket resource labels are NOT aggregate-able in stack driver metrics

Also this is bucket level only- not prefixes

The SD metrics are updated daily so unless you can wait a day you cant use this to get the current size right now

UPDATE: Stack Driver metrics now support user metadata labels so you can label your GCS buckets and aggregate those metrics by custom labels you apply.

like image 150
red888 Avatar answered Oct 08 '22 09:10

red888