How can I optimise my server to lag less when players are exploring new areas?

Hi there, I'm having a lot of lag issues specifically when my players are exploring new regions. If people move far enough, the server essentially locks up and prevents anything from happening for sometimes minutes. How can I best rectify this?
51 Replies
Admincraft Meta
Admincraft Meta5mo ago
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by element3329#0
ProGamingDk
ProGamingDk5mo ago
Pregen and worldborder Are you using paper on a newer version of mc?
Element
ElementOP5mo ago
Paper 1.21 I believe I should pregenerate with Chunky?
ProGamingDk
ProGamingDk5mo ago
Ye
Element
ElementOP5mo ago
Its lagging a lot even when people fly around pre-generated areas
ProGamingDk
ProGamingDk5mo ago
Use 1.21.1 asap
Element
ElementOP5mo ago
If they're flying with elytras it hurts the server bad Will this fix the lag?
ProGamingDk
ProGamingDk5mo ago
If you have high view/sim distance and a slow cpu etc then yes loading itself can be heavy No 1.21 just has dupe, chunk ban etc
Element
ElementOP5mo ago
Chunk ban?
SilentBot
SilentBot5mo ago
Crashing players who enter certain chunks intentionally
Element
ElementOP5mo ago
Ah I see. All of my players are close friends so not an immediate concern, but I'll get around to updating this weekend. Just concerned about my plugins
SilentBot
SilentBot5mo ago
Slow disk performance, and non pre-generated worlds are the biggest cause of lag when exploring Same with high view/sim distances
Element
ElementOP5mo ago
So you think I should lower sim distance? View distance I'd like to keep around 10 so my players can see well, since we average only about 5 players at a time
SilentBot
SilentBot5mo ago
10 should be fine, it's the default/recommended You can provide a spark report if you want us to see if it's world generation or loading that is causing the actual lag
Element
ElementOP5mo ago
Alright, I'll go do a bit of what I was doing when it was lagging, and I'll upload a 5 min report !spark
Carl-bot
Carl-bot5mo ago
Spark Profiler
Spark can be used to see why your server or client is lagging. Users can share a spark report via /spark profiler start --timeout 300 which creates a report after 5 minutes. The spark report is useful in debugging why your server is lagging, so ideally you should always provide one while asking for support. Download | Website | Docs
From An unknown user
Admincraft Canned Responses
Element
ElementOP5mo ago
Here we go
Element
ElementOP5mo ago
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Admincraft Meta
Admincraft Meta5mo ago
Spark Profile Analysis
These are not magic values. Many of these settings have real consequences on your server's mechanics. See this guide for detailed information on the functionality of each setting.
❌ entities.spawning.despawn-ranges.monster.soft
Decrease this in config/paper-world-defaults.yml. Recommended: 28.
❌ entities.spawning.despawn-ranges.monster.hard
Decrease this in config/paper-world-defaults.yml. Recommended: 96.
❌ entities.spawning.despawn-ranges.underground_water_creature.soft
Decrease this in config/paper-world-defaults.yml. Recommended: 28.
❌ entities.spawning.despawn-ranges.underground_water_creature.hard
Decrease this in config/paper-world-defaults.yml. Recommended: 96.
❌ entities.spawning.despawn-ranges.water_ambient.soft
Decrease this in config/paper-world-defaults.yml. Recommended: 28.
❌ entities.spawning.despawn-ranges.water_creature.soft
Decrease this in config/paper-world-defaults.yml. Recommended: 28.
❌ entities.spawning.despawn-ranges.water_creature.hard
Decrease this in config/paper-world-defaults.yml. Recommended: 96.
❌ misc.redstone-implementation
Set this to "ALTERNATE_CURRENT" in config/paper-world-defaults.yml.
❌ chunks.entity-per-chunk-save-limit.experience_orb
Set a value in config/paper-world-defaults.yml. Recommended: 16.
❌ chunks.entity-per-chunk-save-limit.snowball
Set a value in config/paper-world-defaults.yml. Recommended: 16.
❌ chunks.entity-per-chunk-save-limit.ender_pearl
Set a value in config/paper-world-defaults.yml. Recommended: 16.
❌ chunks.entity-per-chunk-save-limit.arrow
Set a value in config/paper-world-defaults.yml. Recommended: 16.
Requested by element3329 • Page 4 of 4
SilentBot
SilentBot5mo ago
Your launch flags need improving, and your server is about to oom
Element
ElementOP5mo ago
Should I just go and do all of these recommendations? I think I am already using Aikar's flags so I don't know why it says I'm not. These are the flags I have on my PebbleHost startup panel -Xms5120M -Xmx5120M --add-modules=jdk.incubator.vector -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -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 -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -jar server.jar --nogui I used what was recommended from https://flags.sh/
flags.sh
flags.sh
A simple script generator to start your Minecraft servers with optimal flags.
SilentBot
SilentBot5mo ago
But ignoring that Those are not the flags the server was started with at least
Element
ElementOP5mo ago
Interestinggg....
SilentBot
SilentBot5mo ago
Did you restart it after changing the flags?
Element
ElementOP5mo ago
I believe I did I'll do another restart now thought just incase
SilentBot
SilentBot5mo ago
But yeah, garbage collection is mainly what's eating your performance, not anything server related (or at least it's hard to see with how much garbage collection is impacting it)
Element
ElementOP5mo ago
What even is garbage collection? 😄
SilentBot
SilentBot5mo ago
Java has it's own memory pool it manages, every now and again it goes through that pool and checks for stuff it no longer needs
Element
ElementOP5mo ago
Is there a quick way I can tell if my server is starting up with the right flags?
SilentBot
SilentBot5mo ago
Just start a new spark profile and check the JVM flags tab
Element
ElementOP5mo ago
Hmm.. It's still got the default ones
SilentBot
SilentBot5mo ago
Are you able to show where you set them in the panel? (as long as it doesn't show anything like your IP, etc.) In regards to these flags too, if your plan from Pebble is only 5GB your Xmx should only be ~4GB, so you may want to update it to 4096M, and your Xms should match the Xmx value Looks like the UI does this automatically, good job Pebble.
Element
ElementOP5mo ago
This is what I've got on my panel, I've got a 5GB subscription
No description
SilentBot
SilentBot5mo ago
That does look like the right place to set them
Element
ElementOP5mo ago
You can't see the full text but its what I posted here
SilentBot
SilentBot5mo ago
Unsure why they're not applying though
Element
ElementOP5mo ago
When I pasted them from flags.sh, I used the 'java' section, is that correct? Or should I have used windows or linux/mac
No description
SilentBot
SilentBot5mo ago
Yeah, you'd just take everything after java, so -Xmx... all the way to before -jar as I assume pebble adds the -jar part themselves (by how it's worded)
Element
ElementOP5mo ago
Yeah, that's what I did I believe I've made a support ticket with PebbleHost to see if they can look into it for me. In the meantime, should I apply the changes suggested by this spark profile?
SilentBot
SilentBot5mo ago
If I'm being 100% honest, outside of garbage collection, your server appears to be running super smoothly They aren't magic numbers, and can negatively impact gameplay, so I'd recommend waiting to see if you still have issues after the flags are fixed. (for reference, without garbage collection, you're running at 9.5ms per tick on average, meaning your server could be working 5x harder before you start noticing any lag (50ms per tick is when the tps drops below the expected 20))
Element
ElementOP5mo ago
Alright, awesome 🙂 thank you for letting me know! I'll see if that ticket bears fruit and then hopefully it'll sort itself out
SilentBot
SilentBot5mo ago
🙏
Element
ElementOP5mo ago
Alrighty, the Pebble admins got it sorted at last so the flags now apply
Element
ElementOP5mo ago
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
Admincraft Meta
Admincraft Meta5mo ago
Spark Profile Analysis
These are not magic values. Many of these settings have real consequences on your server's mechanics. See this guide for detailed information on the functionality of each setting.
✅ Your server isn't lagging
Your server is running fine with an average TPS of 20.
Requested by element3329 • Page 1 of 4
Element
ElementOP5mo ago
How does this look? They applied some flags of their own, so I just would like someone to have a once over and let me know if there's anything amiss
SilentBot
SilentBot5mo ago
Looks a whole lot better There are still some g1 old spikes every ~18 minutes, which may be worth investigating, but your average tps has no nasty spikes anymore
Element
ElementOP5mo ago
Awesome. What would you recommend I do to deal with those g1 old spikes? Is it a flag change?
SilentBot
SilentBot5mo ago
It would be, but I have no clue what flags affect it
Element
ElementOP5mo ago
Alrighty, no worries 🙂 thank you! Really appreciated your help with all this !answered
Admincraft Meta
Admincraft Meta5mo ago
post closed!
The post/thread has been closed!
Requested by element3329#0

Did you find this page helpful?