user353859
user353859

Reputation: 73

Transferring lots of small files between EC2 and Amazon S3

I'm building a browser game and I have a lot of small files that need to be transfered between my EC2 instancce and S3 when players perform some key actions.

Although transferring a single big file is fairly fast, transferring multiple small files is extremely slow. I'm using Amazon's PHP SDK.

Is there a way to overcome this weakness in S3? Thanks.

Upvotes: 1

Views: 2235

Answers (4)

Buffalo
Buffalo

Reputation: 4042

How exactly are you uploading files? is there a multithreaded method in the SDK? I'm asking because I've had to implement my own method for downloading stuff faster than the SDK.

Do you need to read those files right away? how many events do you have per second, do you need them ordered?

My first thought would be to make a local buffer that uploads batches every once in a while.

Then, if that's too slow, I'd store them in a fast buffer first, instead of S3, and flush it every once in a while. My choices would be simple stuff like SQS or Redis. SQS has theoretically unlimited throughput for random queues and 300 batches per second (1 batch = 1..10 messages = 0..256kb) for FIFO queues - which you can further increase.

Then you have streams, Lambda and whatever.

Upvotes: 0

user353859
user353859

Reputation: 73

It looks like combining the two solutions below is the way to go.

http://improve.dk/archive/2011/11/07/pushing-the-limits-of-amazon-s3-upload-performance.aspx http://gearman.org/

Upvotes: 1

PBelzile
PBelzile

Reputation: 118

The performance of S3 is not constant and can be quite slow sometimes. If you need real-time performance for a shared object I would take a look at the AWS memcached service although I have not used it.

Upvotes: 0

Avichal Badaya
Avichal Badaya

Reputation: 3629

If this transfer has to be made from EC2 instance to S3 then may be you can try using s3fuse , which will basically mount your s3 drive to storage volume of EC2 instance.

Upvotes: 0

Related Questions