My main advice, ignore all advice online about JVM tuning minecraft. It's dated and often just wrong.
The best thing you can do is run on the latest JVM, set your max memory as high as you can tolerate, and use ZGC. That's it.
The JVM tuning guides for minecraft will have you switching and toggling every JVM flag under the sun with extremely dubious "evidence" of the payout for the flags they switch. In some cases, they will set contradictory flags. For example, setting eden size and target pause time. The fine tuning flags disable the heuristic flags like target pause time.
KISS. ZGC has very low latency and the larger the heap you give it the less it'll slow things down (though, do keep it under 32gb. Object header compression works on heaps less than 32gb). And using the latest JVM reduces the memory needed and increases the performance in general of the JVM. Win-win.
Do not set the heap size to more than 8GiB, even if using heavy modpacks. Anything above 8GiB actually makes the game run worse, unless you have tons of players, because of GC lag.
Set JVM heap to half available memory. Mincraft is very much the kind of appication that benifits from filesystem cache to help with loading chunks.
Also if for some reason you are setting the heap size high avoid going past 32 gb unless you tune object alignment. Allocating between 32 and 47 gb will result in an effectively smaller heap. Allocating more than 32 gb can result in performance penalties.
It did used to be required. Older Java versions performed pretty terrible. However, Java 17+ completely fixed that. Even the heaviest modded setups run buttery smooth, even on older versions which are not well optimized.