Power2All / torrust-actix

A multi-functional lightweight BitTorrent Tracker
MIT License
86 stars 5 forks source link

Defragmentation of BTreeMaps #18

Closed Power2All closed 1 year ago

Power2All commented 1 year ago

I noticed a high memory usage after a while, and this is because the BTreeMap get fragmented after a while. Going to work on a custom block system for the BTreeMap, so that I can make a thread that will clean up the fragmentation every often, without locking up the system too much. A proof of concept will be worked on for version 3.1.2

Power2All commented 1 year ago

First version of defragmentation pushed. Needs still to be tested, and possible "maintenance" toggle needs to be applied when it's doing this, to prevent clients to timeout for no reason, returning a "error" that the tracker is in maintenance when it's defragmenting, they will mostly re-try later as well.

Power2All commented 1 year ago

Tested, working pretty fast, added still the maintenance option, but it's optional :)

Power2All commented 1 year ago

Might be reverting, memory usage haven't been going lower as expected.

Power2All commented 1 year ago

Eventually, been monitoring the system, and it looks like it's not a issue with btreemap. Seems the UDP handling made some extra memory overhead, will be tweaking that more.