the8472 / mldht

Bittorrent Mainline DHT implementation in java
Mozilla Public License 2.0
147 stars 45 forks source link

Invalid options with newer JDKs #37

Open rakoo opened 11 months ago

rakoo commented 11 months ago

Hey there, first of all thanks a lot for all you do around Bittorrent and for this project ! I've been using another one to crawl locally but as you said on the orange website it's not good if nodes are not behaving properly, so I trust your project to be much better.

I tried to run it but some of the options are so old that they were not only deprecated but removed. I'm talking about the Concurrent Mark and Sweep Garbage Collector, which has been removed in JRE 14 (see https://openjdk.org/jeps/363). There are other options as well.

Here's a diff of the options I currently use with JRE 21:

diff --git a/bin/mldht-daemon b/bin/mldht-daemon
index d8f807d..baa5ec5 100755
--- a/bin/mldht-daemon
+++ b/bin/mldht-daemon
@@ -7,14 +7,12 @@ UNLOCK="-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions"
 # PROFILER="-agentpath:$DIR/../lib/libjprofilerti.so=port=10040,address=127.0.0.1,nowait"
 # PROFILER="-agentpath:$DIR/../lib/libyjpagent.so=listen=127.0.0.1:10040,telemetryperiod=100"

-GC="-Xms300m -Xmx1500M -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:MaxGCPauseMillis=15 -XX:GCTimeRatio=19 -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly"
+GC="-Xms300m -Xmx1500M -XX:+UseZGC"

-LOG=(-Xloggc:logs/gc.log -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -XX:+HeapDumpBeforeFullGC -XX:+HeapDumpOnOutOfMemoryError "-XX:OnOutOfMemoryError=kill -9 %p")
+LOG=("-XX:OnOutOfMemoryError=kill -9 %p")

 DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:10044,server=y,suspend=n"

-OPTO="-XX:+AggressiveOpts -XX:MaxInlineLevel=12 -XX:+TrustFinalNonStaticFields -XX:+AggressiveUnboxing"
-
 PERF_EVENTS="-XX:+PreserveFramePointer"
the8472 commented 11 months ago

Those settings were optimized for a machine with lots of addresses and like 20k packets per second anyway. If you're running something smaller then they're not necessary and G1GC would probably work fine too.