AWS S3 buffer size not increasing

守給你的承諾、 提交于 2020-06-17 02:06:26

问题


I am creating an S3 client with a modified buffer size, however, it does not seem to make a difference as always the same amount of bytes is read from the stream. Example code:

var s3Client = new AmazonS3Client(access, secret, token, new AmazonS3Config
{
     RegionEndpoint = Amazon.RegionEndpoint.USEast1,
     BufferSize = 1000000, // 1 MB (completely arbitrary)
});

await s3Client.PutObjectAsync(new PutObjectRequest 
{
     Key = fileName,
     Bucket = bucketName,
     InputStream = new MyCustomStream(...)
});

When I debug this example, however, instead of reading a megabyte at a time from MyCustomStream, the buffer size is 81920 bytes which is the default for Stream. This leads me to think that the AWS implementation has not overridden the size.

From the documentation I assume that this is the correct property - int BufferSize : The BufferSize controls the buffer used to read in from input streams and write out to the request. I am indeed reading from an input stream so I would expect that this would get overridden.

来源:https://stackoverflow.com/questions/61917654/aws-s3-buffer-size-not-increasing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!