-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
curl: set a 100K buffer size by default #1446
Conversation
Test command 'time curl http://localhost/80GB -so /dev/null' on a Debian Linux. Before (middle performing run out 9): real 0m28.078s user 0m11.240s sys 0m12.876s After (middle performing run out 9) real 0m26.356s (93.9%) user 0m5.324s (47.4%) sys 0m8.368s (65.0%)
@bagder, thanks for your PR! By analyzing the history of the files in this pull request, we identified @yangtse, @captain-caveman2k and @tatsuhiro-t to be potential reviewers. |
Ah, forgot to update some tests. Will do. Interestingly, changing |
I suspect this is unnecessary and you should back it up with some typical real world data scenarios. Even if there's a very slight difference in a corner case iirc the user can already set up to a 500k buffer size via rate limiting. For comparison I ran your 80GB test in Windows. There is create file:
bagder/curl-larger-buffer:
parent you branched from, 7474418:
Server: Apache/2.4.18 (Win64) |
I think this is an easy fix that makes some improvements at a very low cost. And it doesn't touch the library which makes it even less risky. To me, the numbers I've already shown is reason enough: curl will use less CPU and system resources this way. Sure, for regular network transfers it will be bottle-necked by the bandwidth but being lightweight is also a good virtue. But there are some actual network speed reasons too, as you mention. SFTP in particular will get a serious boost with this. SFTP 4GB over localhostold real 0m32.391s new (larger buffer) real 0m28.212s So, about 10% faster here. SFTP 4GB over a 200ms latency link(test run by adding latency to 'lo') old Transfer rate: 310KB/sec new Transfer rate: 1930KB/sec (The ratio in this speed increase is almost identical to the ratio of the buffer increase...) HTTP over a 200 ms latency linkAs a comparison to see what it fares when we add latency to the mix and thus it isn't completely CPU bound anymore. old real 0m35.536s new real 0m35.319s Virtually no speed difference, but slightly lower system load. |
sftp is the real winner here. I take issue though with it being less resources. You're trading one resource for another. sftp it's clearly worth it. |
Test command 'time curl http://localhost/80GB -so /dev/null' on a Debian
Linux.
Before (middle performing run out 9):
real 0m28.078s
user 0m11.240s
sys 0m12.876s
After (middle performing run out 9)
real 0m26.356s (93.9%)
user 0m5.324s (47.4%)
sys 0m8.368s (65.0%)