-
Notifications
You must be signed in to change notification settings - Fork 27
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
Very slow linux download speed, excessive disk and cpu usage #83
Comments
a "cold start" here: $ time pr-downloader ba:stable with a debug build of pr-downloader (which outputs to console A LOT) to a normal hard-drive (no ssd). thats 1,37MB/s (i've a 16MBit connection, ~1.6MB is the max speed). i agree that i/o can be heavily optimized, but i don't have this issue. Is your harddisk maybe broken or starting to die? |
what params do you use to mount the disk where pr-downloader stores its files? (usally ~/.spring/) also side note: safety was chosen over speed: currently when pr-downloader crashes / is killed it shouldn't leave broken files on disk which are read/used by spring. (with some enhancements, the same can be accomplished with insane speed :) ) very likely the cause of the speed drop is fsync()... |
Hi, I'll test this on multiple drives, it's the only program that's giving me headaches on this disk though. Latest Ubuntu: $ time ./pr-downloader ba:stable real 6m36.453s That's clearly waiting on IO (and the network is just fine) Gentoo in chroot: time ./pr-downloader ba:stable real 1m50.288s It still crunches the disk/cpu, but it's considerably better. The setup I have could force most syncs to be "real" disk syncs so that's one thing, I need to change kernels to figure out what's going on because I didn't expect it to be that much lower on gentoo. With the in-memory check and no syncs on python, download time is pretty much limited to bandwidth, so I'm getting < 10 seconds there, but this is too weird so I'll check kernel/SMART/sata settings. |
Fyi, its fine on my archlinux system: |
Thanks for that, my best time so far was 1:50 on a different setup with another hdd (but this one isn't new either), even with noatime, either way it's much better than 6 minutes. I don't have new hdds to test this with and no ssd either.
|
can you test this please? mkdir -p /tmp/test && time pr-downloader --filesystem-writepath /tmp/test ba:stable && time rsync -a /tmp/test /tmp/test2 the fsync is/was there because when developing for several times i got 0 byte files. |
also, can you please provide your mount flags? |
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered) Linux computer 3.19.0-26-generic #28-Ubuntu SMP Tue Aug 11 14:16:32 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux real 1m54.791s real 0m0.315s Interesting rsync data: rsync -a rsync://ftp... (local fast gentoo portage mirror) . real 0m53.743s rsync full portage dir from one drive to another: and back again ... total portage files both drivers are: Similar rsync numbers from: back to pr-downloader/ubuntu, 4gb test partition, ba:stable:
real 1m10.029s
default mount options real 0m55.237s +noatime real 1m2.008s
real 2m11.110s +commit=120,noatime data=ordered real 2m14.939s +noatime,data=writeback real 1m38.727s
real 1m58.384s noatime,data=writeback,commit=120 real 1m52.160s Git clones (but it looks like the network is the bottleneck here) time git clone https://github.com/springlobby/springlobby real 2m49.751s other drive |
https://github.com/spring/pr-downloader/blob/master/src/Downloader/Rapid/Sdp.cpp#L197-L205
This closes each downloaded file, then reopens/rereads and checks md5:
pr-downloader/src/FileSystem/FileSystem.cpp
Lines 48 to 54 in 5397db3
Since the curl write calls are sequential:
pr-downloader/src/Downloader/Rapid/Sdp.cpp
Line 276 in 5498204
... this blocks the download loop until each file is opened, written to, closed, re-opened, loaded in a gzip file object, md5 checked and closed again.
There are much better/faster ways to check the files in-memory, during streamer download, by chunks, using gzip, md5 and crc objects - crc might be the fastest and the sdp provides such data, python example (though thoroughly untested early code that's really unstable):
https://github.com/serg9/rapid_nonet/blob/master/receive_loop.py#L118-L146
There's only one file close, no-rereading the file from disk, using zlib.decompressobj and binascii.crc32, they are meant for on-the-fly stream decompression, there have to be c++ ways to do it too.
Memory usage is not a problem since each received chunk fits comfortably in RAM. I don't know if I have some disk issues or it's my current fstab setup, but the current version of pr-downloader is using my disk to 100% and the download speed is ~100-500kbps max (since it waits for disk). In-ram decompression+crc check is substantially faster on my machine.
For me, this makes it unusable under Linux, might also be related to how disk caching is handled, but I didn't look into that because python kind of handles that on its own.
I can't replicate the crash I told you about now but I'll keep trying.
If not enough linux users get this, it should be marked low priority (I have special mounts).
strace http://pastebin.com/f0HEJ1X6
with time of the day http://pastebin.com/dV6070GX , this makes the sluggishness obvious.
The text was updated successfully, but these errors were encountered: