Closed ryxli closed 1 month ago
Hello @ryxli, thank you for opening up that issue.
I can't seem to reproduce the performance downgrade you're observing: would you mind sharing more details? Namely, your instance type and Python + boto3 + s3torchconnector versions?
Here's what I tried:
g4dn.2xlarge
) in ap-south-1
ap-south-1
, and upload a 2 Gb file in itssh
into the EC2 instancevenv
, and run pip install s3torchconnector s3torchconnectorclient boto3 numpy
import time
import boto3
from s3torchconnector._s3client import S3Client
def issue236():
bucket = "my_bucket"
key = "large_2gb"
# s3 torch connector snippet
s3_client = S3Client("ap-south-1")
tic = time.perf_counter()
s3_client.get_object(bucket, key).read()
toc = time.perf_counter()
print(f"mountpoint finishes in {toc - tic:0.4f} seconds")
# boto3 snippet
client = boto3.client('s3')
tic = time.perf_counter()
client.download_file(bucket, key, 'my_large_2gb')
toc = time.perf_counter()
print(f"boto3 finishes in {toc - tic:0.4f} seconds")
if __name__ == "__main__":
issue236()
Overall, the PyTorch connector runs consistently faster than boto3 (example run):
mountpoint finishes in 4.7542 seconds
boto3 finishes in 5.7658 seconds
Finally, here are the versions used for this test:
s3torchconnector 1.2.5
s3torchconnectorclient 1.2.5
torch 2.4.1
boto3 1.35.24
@matthieu-d4r
Am still able to reproduce this issue with your code snippet, this time with a 6GB object.
S3 Bucket region: us-east-1 Ec2 region: ap-south-1
import time
import boto3
from s3torchconnector._s3client import S3Client
def issue236():
# s3 torch connector snippet
s3_client = S3Client("us-east-1")
tic = time.perf_counter()
s3_client.get_object(bucket, key).read()
toc = time.perf_counter()
print(f"mountpoint finishes in {toc - tic:0.4f} seconds")
# boto3 snippet
client = boto3.client('s3')
tic = time.perf_counter()
client.download_file(bucket, key, 'my_large_6gb')
toc = time.perf_counter()
print(f"boto3 finishes in {toc - tic:0.4f} seconds")
issue236()
Output:
mountpoint finishes in 27.9438 seconds
boto3 finishes in 19.0174 seconds
Versions:
import s3torchconnector
import s3torchconnectorclient
import torch
import boto3
print(s3torchconnector.__version__)
print(s3torchconnectorclient.__version__)
print(torch.__version__)
print(boto3.__version__)
1.2.5
1.2.5
2.3.0a0+6ddf5cf85e.nv24.04
1.35.20
boto3 is installed with pip install 'boto3[crt]'
Hi @ryxli,
I ran the snippet again too, against a bucket in a different region (same setup as you: EC2 instance in ap-south-1
and S3 bucket in us-east-1
), and still no performance degradation; I also installed Boto3 with pip install boto3[crt]
.
One question though: I noticed in your PyTorch version an unusual number (2.3.0a0+6ddf5cf85e.nv24.04
), which I found referenced in https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel-24-04.html: are you running this snippet from within a container? Or are you executing it on a "raw" EC2 instance (i.e., ssh
ed in and nothing else)?
I am running this snippet from within a container on the ec2 instance, also from a Jupyter notebook
Hi @ryxli,
As discussed offline with you, we'll proceed to close this issue for now, as we were unable to reproduce the problem.
s3torchconnector version
latest
s3torchconnectorclient version
latest
AWS Region
us-east-1, ap-south-1
Describe the running environment
EC2 instance
What happened?
Getting some significant performance difference between regular boto3 download_obj which uses s3 crt transfer config and mountpoint client, even with various settings for throughput and part size. boto3 client just use the default settings
To reproduce try downloading a 2GB file from s3 with mountpoint client (S3Reader) vs regular boto3 client.
Results:
However, this performance gap seems to disappear in multiprocess setting, but again without any tuning on the transferconfig for boto3
Relevant log output
No response
Code of Conduct