Comments (16)
Thanks for the report. I believe the cause is the way I offload writes to disk which can be too slow for a fast torrent. If you're using a wrapper, could you try the mmap backed data store as an alternative? I'll address the too many open files issue soon. Thanks.
from torrent.
If you're using a wrapper, could you try the mmap backed data store as an alternative?
Can you explain?
from torrent.
In your code at https://github.com/zhulik/go_torrent_bot/blob/master/main.go#L34, you can set TorrentDataOpener to the mmap.TorrentData backend, an example is here in the tests: https://github.com/anacrolix/torrent/blob/master/fs/torrentfs_test.go#L206. This avoids using Open/Close and file handle overhead. Let me know if it's still a problem with this.
from torrent.
Hi, i have updated torrent package, set mmap.TorrentData as you told me.
I see, that memory usage still high, htop shows about 500MB, stable.
CPU usage is high too: 100% of first core + 30-50% of second.
Positive changes: i don't see large numbers of threads, just 7, but on 80% of downloading it was increased to 32. Dowloaded files are valid, no too many open files errors.
Negative:
After downloading, i still have 100% cpu usage by kswap0 process, it is common problem in linux, but no one of found solutions doesn't work for me(maybe problem in kernel, i have old 4.1.6 on target machine, mayby your mmap realization does something wrong with it)
After killing downloader kswap0 process calmed down
All of the above is true for big torrent, about 15Gb(one season of popular animated series, 20 mkv file, each about 600mb).
For small torrents is see only high CPU usage while downloading
from torrent.
That log message is not originating from the torrent package. Perhaps
something else is going on.
On 25 Dec 2015 8:53 am, "Gleb Sinyavsky" [email protected] wrote:
Hi, i hade updated torrent package, set mmap.TorrentData as you told me.
I see, that memory usage still high, htop shows about 500MB, stable.
CPU usage is high too: 100% of first core + 30-50% of second.Positive changes: i don't see large numbers of threads, just 7, but on 80%
of downloading it was increased to 32. Dowloaded files are valid, no too
many open files errors.Negative:
2015/12/25 08:25:58 Failed to get updates, retrying in 3 seconds... in
logs after downloadingAfter downloading, i still have 100% cpu usage by kswap0 process, it is
common problem in linux, but no one of founded solutions doesn't work for
me(maybe problem in kernel, i have old 4.1.6 on target machine, mayby your
mmap realization does something wrong with it)After killing downloader kswap0 process calmed down
—
Reply to this email directly or view it on GitHub
#50 (comment).
from torrent.
Sorry, you answered on old version of comment. I have updated it. Please, read it from web.
from torrent.
Here is my cpu profile. I have no experience in reading go's profiles, but i suppose, that crypto/sha1.block is slow. Am i right?
cpu.pdf
from torrent.
Thanks. How large is the torrent you're downloading? Are you using the file or mmap data backend? What OS/architecture are you using?
from torrent.
I was downloading many torrents about 15-20Gb, all of them has the same client behavior.
Client initialization you can find here, mmap storage. OS: ArchLinux latest, x86_64, 100Mbit internet connection, transmission shows me ~5-7 Mb/s speed
from torrent.
I just configured newrelic monitoring and then download 20Gb torrent. There is graphs
1400 active goroutins while downloading is really great amont. Scheduling of them is not free. Maybe, decreasing it's amount is a good idea?
There is only one active download. What happens if i add many big torrents?
from torrent.
So the cause is that on startup, torrent scans pieces from all files for the mmap and file backends rehashes them all. I moved onto using the pieces backend for my production purposes, and so those file-based backends haven't had enough attention. Some state between restarts is needed. On slow disks (I'm guessing spinning media)/CPU, and for large torrent, the rescan can be very expensive and take a while before the torrent can actually do anything else due to being starved for CPU. This can be confirmed by trying with small torrents and seeing they finish hashing first, or waiting out the hashing, and check that CPU drops and download speed picks up.
You can use the Client.WriteStatus to get a read out of what the torrent client is doing, you should see lots of pieces in the 'H' state, like 123H means 123 pieces are being hashed, when the CPU is up.
Let me know, and if you have any suggestions for where to maintain that state. I'm currently considering just a sqlite3 file in the directory that maps pieces to whether they've been checked before or something. Maybe like '.torrent.db'.
from torrent.
Sorry to piggyback on the discussion, but it seems a bit ontopic.Can you give a small example on how to use the pieces backend?
from torrent.
@0x4139 I put an example in the other issue.
from torrent.
@zhulik Any update on your usage of this? Are you still having issues?
from torrent.
I've started working on this.
from torrent.
This was fixed in d80d0db. There's a more recent bug fix to it in 11a53fa.
from torrent.
Related Issues (20)
- Does this anacrolix/torrent support storage permission? HOT 2
- About holepunching test HOT 5
- Reinstate torrentfs on CI using fuse-t?
- x/exp: breaking changes support HOT 8
- Cannot `go get` this library HOT 3
- Inferring reasons for stopped transfer? HOT 3
- Race from peerconn on data read of closed torrent with [email protected] HOT 4
- Clean up ClientConfig HTTP options HOT 3
- error bootstrapping during bucket refresh: getting starting nodes: nothing resolved [dht 0.0.0.0:42069 github.com/anacrolix/dht/v2 server.go:1395] HOT 7
- Webseed download extremely slow HOT 1
- Count the number of bytes uploaded or downloaded. HOT 6
- Peer Selection Algorithm
- undefined: sync.OnceFunc HOT 7
- Support passing context to `torrent.Reader` HOT 1
- How to config DHT listen port? HOT 4
- Add global semaphore to limit amount of pieceHashers
- Problem getting magnet metadata on large files HOT 6
- Client requests indefinitely on storage write errors HOT 42
- More than 3 times slow download speed over sqllite storage HOT 9
- Prioritize the use of local peers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from torrent.