confluence icon indicating copy to clipboard operation
confluence copied to clipboard

Improve torrent cache

Open gadelkareem opened this issue 6 years ago • 5 comments
trafficstars

Currently all torrents are saved in one directory in the binary root. This PR will use the FileDir flag to move that directory to the user input path and separate the files using the first 3 chars of each hash.

gadelkareem avatar Mar 07 '19 04:03 gadelkareem

Thanks. I think I did it like this to reduce configuration overhead: The working directory is used to determine all this stuff. Is there any reason this isn't sufficient?

anacrolix avatar Mar 08 '19 04:03 anacrolix

There shouldn't be any further config needed. But it is a personal preference that I need to have all the cache on a mounted drive and to make sure the number of files in one directory is not too large. Feel free to close it if you disagree.

gadelkareem avatar Mar 08 '19 16:03 gadelkareem

I don't see any reason to have a separate config option if the working directory thing is sufficient for now. Partitioning the torrents seems useful, I'm guessing you have a lot of them if you're having performance issues due to the DHT. I think common practice is to split with 2 to 4 hex characters at a time to achieve the desired directory fill.

anacrolix avatar Mar 11 '19 03:03 anacrolix

This makes sense now, but I think an interface should be exposed for alternative implementations instead.

anacrolix avatar Apr 13 '20 01:04 anacrolix

I have a fix coming for this.

anacrolix avatar Sep 03 '21 12:09 anacrolix

This PR is a bit out of date now. I exposed MetainfoStorage which stuffs it into a squirrel.Cache. It's not perfect for all situations, but should solve your original problem.

anacrolix avatar Aug 30 '22 04:08 anacrolix