These are chat archives for anacrolix/torrent

8th
Jan 2018
Matt Joiner
@anacrolix
Jan 08 2018 02:05
@elgatito do you use the go utp and not go-libutp with your plugin? i just realised this might contribute to any performance issues or stalling you might get if so. try with DisableUTP in your config if you can't use cgo (or use confluence as an external process?)
Denis
@elgatito
Jan 08 2018 07:12
We only can use cgo for builds, but I can force usage of go-libutp
herrwusel
@herrwusel
Jan 08 2018 07:27
I have seen the issue #227 . Do you need any additional information? I think I'm experiencing the same behaviour.
Denis
@elgatito
Jan 08 2018 08:57
hm... very interesting. same code, same libraries, but compiled with cgo and file storage is only 300Kb/s, compiled with go build and getting 3.5mb (maximum wifi speed)
Denis
@elgatito
Jan 08 2018 09:40
now totally puzzled... again building with "go build:, 10gb file and getting 400kb/s
tested with 1.5gb file, also 400kb/s
Denis
@elgatito
Jan 08 2018 10:38
fun. adding this to main.go _ "net/http/pprof" is causing slow speed with files
Denis
@elgatito
Jan 08 2018 12:39
and now I can't find any logic, in any build way downloading to files is about 400 kb/s, downloading to memory is 3mb/s
Matt Joiner
@anacrolix
Jan 08 2018 12:40
is that with file storage with handle reuse, or just the one that's in torrent master?
Denis
@elgatito
Jan 08 2018 12:40
the default one, without no changes
sometimes it downloads fine, then later it's 400kbs
strange it's always about 400kbs
Denis
@elgatito
Jan 08 2018 13:45
interesting! I run client, with ListenAddr:"0.0.0.0:6891", speed is great, as expected
then restarting the client/program and speed is only 400kbs
the changing to ListenAddr:"0.0.0.0:0" and speed is again great
and that is only with file storage
Denis
@elgatito
Jan 08 2018 14:28
okay. so, I create new client with torrent.NewClient(), send ListenAddr:"0.0.0.0:6891", then I close it properly with client.Close() and create new client with the same ListenAddr - and download is limited
doing the same with 0.0.0.0:0 - same behavior
if I restart client with the same ListenAddr - speed is limited, if I change it to anything - speed is fine
also when calling Client.AddTorrentFromFile(uri) i'm waiting around 30 seconds for it's result
Denis
@elgatito
Jan 08 2018 14:44
when this strange thing is not active - AddTorrentFromFile acts very quick
but why only with DefaultStorage?
cl.AddDHTNodes(ss)
do we need this and not the go cl.AddDHTNodes() ?
Denis
@elgatito
Jan 08 2018 15:21

I have possibly found a reason:

    if completion, err := storage.NewBoltPieceCompletion(s.config.ProfilePath); err == nil {
        s.PieceCompletion = completion
    } else {
        s.PieceCompletion = storage.NewMapPieceCompletion()
    }

I was using BoldPieceCompletion for non-memory storages, but did not close it on restart

Denis
@elgatito
Jan 08 2018 16:13
looks like i've figured it out. everything works fine when I disable boltpiececompletion and use mapcompletion
when I debugged caching scheme I met huge timings on db.Set routines
like 100-500ms per call
Denis
@elgatito
Jan 08 2018 16:30
I will probably write a new completion which is based on memory map and serialized into the boltdb with one write/read