[GUIDE] Optimizing Spigot - Remove lag, Fix tps & Improve performance!

Status
This thread has been locked.

Marvel

★Builder-MCM Addict★
Banned
Feedback score
9
Posts
298
Reactions
183
Resources
0
A few months ago I found a good thread to improve performance for my server, and It worked perfectly so here you have my lovely community.

Copy-paste


Spigot has a lot of performance improvements disabled by default, as they often alter the server so it no longer replicates vanilla behavior. This guide is supposed to help you tweak the settings for optimal performance while understanding what you are actually changing. If you do not understand a setting I mention here, don't change it. If you are curious, reply to the thread (make sure to @Tag me) and ask me what it does. If you are still having issues with performance, take timings (2-5 minutes) and reply here, or make a new thread.

I'll list all the config values you can consider tuning to improve performance while doing my best to explain what the setting does and when you do/don't want to change it.

The guide is currently written for 1.9. Most options appear in 1.8 as well. If they don't, just go to the next option.



1. paper.yml

You will need Paper, a fork of Spigot, to have this file available.
WARNING: Paper is an unofficial version of SpigotMC and not officially supported. It is slightly less stable, but cutting edge / fast.
If you get issues while using Paper, they should be reported on Paper's issue tracker, not to SpigotMC.
Additionally, linking to any Paper-related projects in replies to this thread is NOT allowed and will be removed / get the thread locked!


optimize-explosions
Default: false
Suggested: true


Uses an alternative, more efficient explosion algorithm. Instantly removes dead entities inside explosion.


mob-spawner-tick-rate
Default: 1
Suggested: 2 - 3

This changes how many ticks pass before mob spawners try spawning mobs.
A value of 2 should not affect vanilla behavior much. If mob spawners are lagging your server, this is a good value to play around with.


disable-chest-cat-detection
Default: false
Suggested: true

This will stop chests from looking for ocelots / cats sitting on the chest, thus allowing players to open it even if there is a cat sitting on it.
(Improves performance)


use-hopper-check
Default: false
Suggested: true

The `hopper-check` option in spigot.yml is currently ignored, making it pretty much impossible to optimize hoppers on your own. This option re-enables it.


container-update-tick-rate
Default: 1
Suggested: 3 - 4

Changes how frequently inventories (player, chest, all of them) are ticked. Inventories can appear buggy / laggy when set above 5.


queue-light-updates
Default: false
Suggested: true

Attempts to spread light updates across ticks. Async lighting is currently broken in 1.9, this can help make up for it until fixed.


fire-physics-event-for-redstone
Default: true
Suggested: false

This stops redstone from firing the BlockPhysicsEvent.
A lot of plugins listen on the BlockPhysicsEvent but don't do anything with redstone. Since redstone can flicker extremely frequently on some servers, this can add up to a lot of wasted CPU.
This can be a major improvement on redstone lag.


grass-spread-tick-rate
Default: 1
Suggested: 2 - 4

Ticks between grass updates.
Increasing this will lower grass spread rates! Make sure you set this value to something that makes sense for your server. i.e. skyblock servers may not want to change this at all.


2. spigot.yml

late-bind
Default: false
Suggested: true

This does not change performance and may break some plugins.
This makes your server wait with connecting to any networking until all plugins are enabled. I personally see this as good practice and security, but is completely optional.


mob-spawn-range
Default: 4
Suggested: 3

Controls how far away spawned mobs can be.
We are going to lower how frequently and how many mobs can spawn, so lowering this will create the illusion we haven't lowered mob spawns.


entity-activation-range
Default: animals:32, monsters:32, misc:16
Suggested: animals:6, monsters:16, misc:2

Entities outside these ranges will be ticked less frequently. Animals generally don't need much. "misc" is stuff like item drops. Setting it to 1 may prevent item drops from i.e. flowing in water.
This is a major player in entity performance!


hopper-transfer, hopper-check, hopper-amount
Default: transfer:8, check:8, amount:1
Suggested: transfer:24, check:24, amount:3

This will make hoppers tick three times slower, but move three items at a time. This can break some vanilla behavior, especially stuff like redstone clocks depending on hopper times. Can be a major player in hopper lag.
Requires "use-hopper-check" to be enabled in paper.yml


max-entity-collisions
Default: 8
Suggested: 1 - 2

How many times an entity can collide with per tick. Setting this to 1 usually has no implications. Helps a lot with mob farms.


merge-radius
Default: item:2.5, exp:3.0
Suggested: item:3.5, exp:6.0

The item merger is a powerful way to prevent item drop lag (no more ClearLag!). Setting the item property to 3.5 means items in a radius of 3.5 blocks will be "merged" into one stack of items. Exp has no real downside to merging at a high radius.


view-distance
Default: 10
Suggested: 3 - 5

How many chunks are sent to the player. I generally recommend 4 as setting it to 3 will cause ender pearls to go into unloaded chunks and thus not work.

3. bukkit.yml

spawn-limits
Default: monsters:70, animals:15, water-animals:5, ambient:15
Suggested: monsters:50, animals:10, water-animals:3, ambient:4

These values are more complicated than just "allowed mobs per player", but they do something in that direction. Setting these lower will grant less maximum mobs spawning around players. The more players you have, the lower you can safely set this.


chunk-gc
Default: period-in-ticks:600, load-threshold:0
Suggested: period-in-ticks:300, load-threshold:300

This feature is disabled by default (load-threshold is zero) for no reason, as far as I can tell.
This option will unload chunks that aren't needed (outside players' view distance), freeing up memory and potential CPU resources.


ticks-per.monster-spawns
Default: 1
Suggested: 2 - 5

Controls how often the server should attempt spawning a hostile mob. This accounts for the entire server, not per-player. Setting this high will drastically lower the amount of monsters spawning. I generally recommend 2 unless a server has lots of lag coming from the mobSpawn function or just have too many monsters in general.

4. server.properties

network-compression-threshold
Default: 256
Suggested (standalone server): 512
Suggested (behind local Waterfall/BungeeCord): -1

This option controls how large a packet should be before attempting to compress it. Setting it higher can save some CPU resources at the cost of more bandwidth use, setting it to -1 disables it.
If your server is in a network with the proxy on localhost or the same datacenter ( < 2 ms ping ), disabling the feature should only be beneficial. If your players connect directly to your server, set this to 512. It will save a bit of CPU while still gaining bandwidth.


You can also consider a plugin like ClearLagg if entities are your problem and none of the above settings are working for you. I do not recommend using the automatic entity clearing provided by ClearLagg. Disable them when you get the plugin. You're interested in features like mob-range and chunk-entity-limiter.
 
Last edited:
Banned forever. Reason: Scamming (https://builtbybit.com/threads/marvel-scam-report.275835/, https://builtbybit.com/threads/marvel-scam-report.278566/)
Status
This thread has been locked.
Top