flysystem icon indicating copy to clipboard operation
flysystem copied to clipboard

Limit S3 bandwidth

Open Maxence1502 opened this issue 1 year ago • 5 comments
trafficstars

Hello,

I'm using this version of your library: https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.x

I need to limit the bandwidth to 500 Mbps so as not to saturate my connection when uploading very large files. I haven't found any documentation on the subject, is there a parameter to do this?

Thanks

Maxence1502 avatar May 05 '24 21:05 Maxence1502

I found this parameter for AWS SDK : https://docs.aws.amazon.com/cli/latest/topic/s3-config.html#max-bandwidth

But I don't know how to use it via Flysystem

Maxence1502 avatar May 05 '24 21:05 Maxence1502

Bandwidth limiting is part of the CLI, not of the S3 API as far as I can tell. Assuming you're uploading files via writeStream it should be possible to implement a RateLimitingAdapter decorator.

SamMousa avatar Aug 13 '24 12:08 SamMousa

Do you know how to do that ?

Maxence1502 avatar Aug 13 '24 16:08 Maxence1502

I do not at this moment. It's solvable via PHP stream wrappers, but you'll have to do the research yourself.

SamMousa avatar Aug 13 '24 17:08 SamMousa

To create a RateLimitingAdapteror LimitUploadBandwithAdapter wrapper, you could extend DecoratedAdapter and just override write() and writeStream() with functions that create a new stream (extend StreamInterface) with a built-in periodical 'delay'.

jgivoni avatar Aug 22 '24 07:08 jgivoni