Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit S3 bandwidth #1792

Open
Maxence1502 opened this issue May 5, 2024 · 5 comments
Open

Limit S3 bandwidth #1792

Maxence1502 opened this issue May 5, 2024 · 5 comments

Comments

@Maxence1502
Copy link

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
Copy link
Author

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

@SamMousa
Copy link

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.

@Maxence1502
Copy link
Author

Do you know how to do that ?

@SamMousa
Copy link

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

@jgivoni
Copy link

jgivoni commented Aug 22, 2024

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants