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

improve rate control for high level API #446

Merged
merged 3 commits into from
Sep 9, 2019

Conversation

wakabayashik
Copy link
Contributor

The original rate control is too rough for me, so I improved the rate control of the high level API.
Note that transferChunkSize may be changed internally to optimize the low rate limit.

@robinrodricks
Copy link
Owner

Oh great this seems quite advanced. Can you explain the changes you made and why? And whats the hardcoded value for 1 second (1000 ms) used for?

@wakabayashik
Copy link
Contributor Author

wakabayashik commented Sep 5, 2019

  1. I deleted the hard-coded 1 second. due to this one second, the FTP client sends the data as fast as possible in the first second, and then sleeps for hundreds of seconds to try to keep low rate limit specified. I don't know what that means in this "hard-coded 1 second".

  2. I modified to adjust the chunk size according to rate limit value. rate control is strongly concerned with chunk size. large chunk against low rate limit makes many peaks, adjusted chunk makes it smooth. of course this adjustment can be achieved using exposed "TransferChunkSize", but its hard for users.

  3. I modified so that the stopwatch (rate control criteria) is not restarted every loop. restarting of the stopwatch makes a slight deviation from the specified rate limit. Its only be done if actual rate behind the specified rate.

@robinrodricks
Copy link
Owner

Can you explain how this works?

@wakabayashik
Copy link
Contributor Author

wakabayashik commented Sep 6, 2019

Here are I/O graphs captured by Wireshark showing the transfer throttling before & after the update.

Old version

FluentFtp v27.0.3
As you can see the data is transferred in bursts in order to restrict the transfer speed to the limit that you have set.

  1. file size = 210MBytes, UploadRateLimit = 10MBytes/sec, FluentFtp v27.0.3
    wireshark_IOGraph_original_10MBps

  2. file size = 150MBytes, UploadRateLimit = 500kBytes/sec, FluentFtp v27.0.3
    wireshark_IOGraph_original_500kBps

enlarge around peak of 2.

first peak
wireshark_IOGraph_original_500kBps_peak1

second peak
wireshark_IOGraph_original_500kBps_peak2

last peak
wireshark_IOGraph_original_500kBps_peak3

New version

FluentFtp v27.1.0+
As you can see the data is transferred consistently at a lower speed in order to restrict the transfer speed to the limit that you have set. There are no bursts.

  1. file size = 210MBytes, UploadRateLimit = 10MBytes/sec, FluentFtp improved
    wireshark_IOGraph_improved_10MBps

  2. file size = 150MBytes, UploadRateLimit = 500kBytes/sec, FluentFtp improved
    wireshark_IOGraph_improved_500kBps


FluentFtp v27.0.3 has big peaks that violate the limit. Such peaks can cause quality degradation for systems such as VoIP. On the other hand, the improved version are smooth.

@robinrodricks
Copy link
Owner

robinrodricks commented Sep 6, 2019 via email

@robinrodricks robinrodricks merged commit 108c637 into robinrodricks:master Sep 9, 2019
@robinrodricks
Copy link
Owner

Published to Nuget. Thanks again!

https://www.nuget.org/packages/FluentFTP/27.1.0

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

Successfully merging this pull request may close these issues.

2 participants