There's this really smart person, along with many smart people, who has done a lot of work for the Minecraft community. One such contribution is JVM flags. You can read about Aikar's Flags for a better understanding of them, or you can just copy/use the code block below. This block below will use 10GBs of RAM on the server.
If you gather NOTHING else from this, please ALWAYS set Xms and Xmx to the same value. This reserves all the requires RAM for the Minecraft server so that you aren't surprised when you run out of RAM and the OS kills your Minecraft server.
-Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true