I am working on an app in which I need fast file transfers from S3 storage. I have performed several tests and I have found out that downloading a file using AWS S3 Java SDK is 25% slower than downloading a file using basic REST request and reading the data from HTTP stream. I have expected the opposite would be true, yet I can't find a reason for this.
My REST download looks something like this. I download public files from url like http://ift.tt/1P6S2gr
InputStream inputStream = httpsURLConnection.getInputStream();
int length = Integer.parseInt(httpsURLConnection.getHeaderField("Content-Length"));
byte[] data = new byte[length];
for (int i = 0; i < length; i++) {
data[i] = (byte)inputStream.read();
}
My AWS S3 SDK download looks something like this
S3Object s3Object = amazonS3Client.getObject(awsBucket, objectName);
long length = s3Object.getObjectMetadata().getContentLength();
byte[] data = new byte[(int)length];
S3ObjectInputStream s3ObjectInputStream = s3Object.getObjectContent();
for (int i = 0; i < data.length; i++) {
data[i] = (byte) s3ObjectInputStream.read();
}
Does anyone have / had the same issue? For any ideas which may be the reason for this I am grateful. I saw some posts which mentioned the opposite, that the upload is slow on AWS forums yet none came to any conclusion.
from Newest questions tagged java - Stack Overflow http://ift.tt/1KV6avG
via IFTTT
Aucun commentaire:
Enregistrer un commentaire