Question Amazon S3 SDK, add mutlithreading to file upload


VB.NET Forum Moderator
Staff member
Jun 3, 2004
Lansing, MI; USA
Programming Experience
I'm using the Amazon S3 SDK for .Net and have gotten the large file uploading to work by following their documentation: Upload a File - Amazon Simple Storage Service

The SDK can be gotten for free using NuGet, which is built into VS2015.

Basically what it does is has you loop the source file and create a series of UploadPartRequests (they suggest 8MB chunks) that get passed into a s3Client.UploadPart() function which I believe does the actual uploading of the section but their article has it doing that all in a single loop, one piece at a time, I would like to have 2 or 3 threads going at a time to upload a single file and am wondering if anyone else on here has done something like this before?

My thoughts right now are to take that loop and build the UploadPartRequests putting them into a Queue collection, once the queue is filled I could launch the 2 or 3 threads that simply pull a segment from the queue and keeps doing that until the queue is empty, then I call the s3Client's CompleteMultipartUpload function so s3 can combine them into a single file. Am looking for advice/tips on doing this.

My project is targetting the 4.0 Framework, but I could bump it up to 4.6 if needed to make the threading pieces easier as I haven't done threading since .Net 2.0
Top Bottom