Skip to content

Instantly share code, notes, and snippets.

@danthegoodman1
Created May 17, 2024 13:01
Show Gist options
  • Save danthegoodman1/29f8ef2738c575593addc9e4d4740a21 to your computer and use it in GitHub Desktop.
Save danthegoodman1/29f8ef2738c575593addc9e4d4740a21 to your computer and use it in GitHub Desktop.
Find the time to first byte of an S3 file
import requests
def ttfb(bucket, path):
url = f'https://{bucket}.s3.amazonaws.com/{path}'
response = requests.get(url, stream=True)
return response.elapsed.total_seconds()
print(ttfb('tcga-2-open', '/08fe7d9d-05b0-46dd-a4f7-2794b88d3a1e/251262%%20984e48d4-d2d0-4dee-957a-20a9d1150781.htseq.counts.gz'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment