ckcr4lyf / kiryuu

A highly performant HTTP bittorrent tracker (WIP)
Do What The F*ck You Want To Public License
13 stars 3 forks source link

Limit ZRANGE #19

Closed ckcr4lyf closed 1 year ago

ckcr4lyf commented 1 year ago

With recent changes, we are no longer shuffling, and just return (upto) first 50 seeders / leechers

https://github.com/ckcr4lyf/kiryuu/blob/f9b745f732dd5b9da3aa73e08a5de46e035a1fb2/src/main.rs#L142-L152

It would be better if we limit the ZRANGE to 50, this way it is no longer O(N) , and we can cutdown on xfer between redis & kiryuu. Otherwise, a popular torrent leads to heavy load on ZRANGE on cache misses, leading to higher CPU load:

image