ProtocolLib icon indicating copy to clipboard operation
ProtocolLib copied to clipboard

Bad performance in large servers

Open peterbro1 opened this issue 3 years ago • 1 comments

Describe the bug There seems to be a memory leak involving network markers that becomes critical at long server uptimes.

To Reproduce Steps to reproduce the behavior:

  1. Fresh 1.12.2 server
  2. Add protocol lib
  3. 200+ players on/off for 10+ hours

Expected behavior Protocol lib uses a relatively constant amount of memory

Screenshots https://gyazo.com/c7046e4929b230fd040b0122f7cadb99 https://gyazo.com/9fa36aa2b92d355635b364f594f6fc4d https://gyazo.com/155f3bbac5ac49d6c4eaade4c64bfcd9

Version Info https://pastebin.com/vEJrEsZ5

Additional context I don't have a lot of time to work and study how the plugin works, but I believe it to be an issue with weak references and packet hashcoding. The long cpu time can almost certainly be attributed to the packetMarker WeakHashMap in ChannelInjector.java. It is using the Object class's default hashcode function, which is very slow. Whatever the value half of the entry is inside the packerMarker map, it should have a wrapper and overridden hashcode function to preserve performance. The memory leak could be anything- I have no idea, but am not getting a whole lot of progress looking through the code. Hopefully you can help!

peterbro1 avatar Dec 20 '21 01:12 peterbro1

Is this still an issue in 5.0?

dmulloy2 avatar Sep 05 '22 19:09 dmulloy2