0

I lost in google docs. Using python to download files from gcs. Below is my code

  source_bucket = storage_client.bucket('mybucket')
  blob = source_bucket.get_blob('myFileOf1Gb')
  print('chunk size', blob.chunk_size) # prints None 
  blob.chunk_size = 1024 * 1024 * 256
  print('chunk size', blob.chunk_size) # 
  print('download started')
  contents = blob.download_as_bytes()
  print('download completed')

It takes around 22 sec to download file irrespective of chunk_size I tried this with various chunk size options still same time require to download. Am i missing something ?

Djai
  • 188
  • 10
  • Why do you expect `chunk_size` to affect download speed for your example? If you are implementing parallel downloads and you have sufficient network bandwidth, performance can be increased by overlapping requests. The chunk size can also be used to improve performance on unreliable networks by reducing the size of requests that must be retried. – John Hanley Jul 18 '23 at 17:48
  • I was expecting if we increase chunk size it will increase download speed. Other wise whats use of chunk_size ? – Djai Jul 23 '23 at 13:44
  • Another linked question is : https://stackoverflow.com/questions/76747991/cloud-bucket-blob-download-is-very-slow-in-cloud-run – Djai Jul 23 '23 at 13:46
  • Re-read my comment. Chunk size has little to no effect on TCP transfer speed (except to make it worse) for a single data stream. The Nagle algorithm controls TCP performance [link](https://en.wikipedia.org/wiki/Nagle%27s_algorithm). – John Hanley Jul 23 '23 at 16:52

0 Answers0