Minecraft Blogs / Tutorial

Ultimate Guide to Remove Server Lag

  • 14,384 views, 2 today
  • 8
  • 3
  • 5
123keelos_'s Avatar 123keelos_
Level 40 : Master Herobrine
20
Hello! A lot of people are having problem with lag lately. So i decided to write a guide to boost performance for better gameplay

Open up your spigot.yml. This is where we can squeeze the most performance out of a vanilla setup. Locate the "world-settings" section of your config.

First, disable anti-xray unless you really need it. This can impact performance quite a bit.
You can other anti x-ray plugins.

Next, entity-activation-range. These settings affect when mobs will be fully ticked relative to a player's position. I would suggest:


Spoiler - Code (Text)
entity-activation-range:
  animals: 16
  monsters: 12
  misc: 2

Next, we'll adjust hoppers. I would recommend these values:

Spoiler - Code (Text)
ticks-per:
  hopper-transfer: 24
  hopper-check: 24
hopper-amount: 3

Next, max-entity-collissions. This is how often an entity can have a calculated collision per tick. Generally you don't need this to be that high. I would suggest a value of 2 or 1.

Next, max-tick-time. This is how long a tick/tile can be processed before skipping it and carrying on. I would recommend these values:

Spoiler - Code (Text)
max-tick-time:
  tile: 10
  entity: 20

Lowering these from the default 50 can drastically improve performance, but also make your mobs appear to stutter - play around with these values if they give you issues.

item-despawn-rate isn't one I would normally recommend adjusting, but if you have issues with too many drops, I would advise lowering this (instead of clearing them with i.e. clearlag).
Instead, you should adjust merge-radius. This controls how large areas of drops should be merged into one. I would suggest these values:


Spoiler - Code (Text)
merge-radius:
  item: 4
  exp: 6


view-distance. This is an important one. I would suggest setting it to 5-10, but depending on your gamemode, something higher may be necessary.

chunks-per-tick. This controls how many chunks will have their crops grown per tick. The default is 650, I would recommend setting that to 80, which is roughly one eigth of the default. This will make crops grow at an eighth of their regular speed, so scroll back up in your file and find growth modifiers. Set all of these to 800:

Spoiler - Code (Text)
growth:
  cactus-modifier: 800
  cane-modifier: 800
  melon-modifier: 800
  mushroom-modifier: 800
  pumpkin-modifier: 800
  sapling-modifier: 800
  wheat-modifier: 800

This will make them grow 8 times as fast - should give you a roughly vanilla crop growth.

That's it for spigot.yml. Let's set a few things in bukkit.yml as well.

Now for spawn-limits. These are roughly how many entities are allowed per player. I would recommend:

Spoiler - Code (Text)
spawn-limits:
  monsters: 50
  animals: 10
  water-animals: 3
  ambient: 4


I lowered ambient drastically from the default 15, as bats currently serve no ingame purpose. I would recommend setting these ticks-per values as well:

Spoiler - Code (Text)
ticks-per:
  animal-spawns:400
  monster-spawns: 2
  autosave: 3000


Most notably, I've changed monster-spawns from 1 to 2. This will drastically help on skyblock servers with a lot of "invalid" spawn positions.

chunk-gc is a neat little feature in spigot that is disabled by default. We'll enable it by setting these parameters:

Spoiler - Code (Text)
chunk-gc:
  period-in-ticks: 300
  load-threshold: 300

This will make spigot unload unused chunks every now and then, drastically lowering memory usage over long sessions.

Lastly, I'll talk about the launch script.
You should really only be using two flags - ConcMarkSweepGC and Xmx:

Spoiler -Code (Text)
java -Xmx2G -XX:+UseConcMarkSweepGC -jar spigot.jar


The ConcMarkSweep has been tested and approved by many people, including sk89q.
Xms is really unnecessary, java is smarter than having it's minimum memory allocated with a spoon.
Also, please always stick to the latest version of java, unless spigot outright does not work with it. It helps a lot!

Additionally, you can get a plugin like ClearLagg to keep entities in check (if that is your problem).

That's about it! If you want to know what a specific option does, and feel my explanation wasn't thorough enough, you can check out the official configuration documentations here:


Spigot.yml
Bukkit.yml

>---------------------------------------------------------------------------------------------<


PLUGINS:

k, well some plugins can help out and reduce lag. Here is a list on what to get

ClearLagg - Clears up ground items, chunks helping and ram free-er
LaggRemover (Spigot) - Can help out with chunks and has a lot of fixes
CoreProtect - Deletes old server data that take up space
WorldGuard - Believe it or not, it has a lag removing system
WorldEdit - Dependency of WorldGuard
ProtocolLib - A fun dependency that's not required

Spoiler - ClearLagg Config
settings:
auto-update: true
enable-signs: true
config-version: 3
disable-waterlife: true
keep-spawn-in-memory: true
enable-api: true

#Should clearlag purge logs under /logs when the server starts?
# -- days-old means how many days old can the log be to be deleted
log-purger:
enabled: true
days-old: 1

#What type of entities SHOULD NOT be removed while doing /lagg area?
area-filter:
- Itemframe
- Painting

#Should clearlag reset the config (more stable), or attempt to add the new paths into your config?
# -- Puting this as false wont reset your config, but may cause bugs.. Still in testing!
config-updater:
force-update: false

#This limits the mob egg spawners so players cannot "overload" the server with them
# -- 'check-radius' stands for the radius clearlag will check for nearby entities
# -- 'max-mobs' is how many entities may be in the radius before the spawning is blocked
mobegg-limiter:
enabled: false
check-radius: 8
max-mobs: 5

#Disable new chunk generation, or just put a cap on how many can load at once.
# -- THIS DOES NOT WORK WITH 1.6.4!
chunk-limiter:
enabled: false
limit: 6000
create-new-chunks: true

#This modifies not only the view of the mobs, but will also simplify how they spawn
# -- Lower it is, the better your entity tick will be
# -- If it's too high, expect bugs / lots of lag
mob-range:
enabled: true
zombie: 100
skeleton: 100
creeper: 100

#How long should items/Mobs be left on the ground
# -- Goes by seconds
live-time:
enabled: false
interval: 10
mobtimer: true
itemtimer: true
arrowtimer: true
arrowkilltime: 15
moblivetime: 600
itemlivetime: 240

#Let clearlag control the spawning in ALL worlds? (Supports all plugins!)
# -- This will also respect cancelations, unlike minecraft's native code
custom-mobspawner:
enabled: false
#How many times should clearlag attempt to find a safe location for the mob to spawn
max-tries: 25
#(In seconds) how often should clearlag try to spawn mobs?
interval: 0
#This is the radius around the player
radius: 30
#This is the radius FROM the player (in blocks!)
radius-from: 7
#How far should mobs spawn from eachother (NOT in blocks!!) (1,010 = around 10-20 blocks)
mob-radius: 1010
#Should we keep trying to spawn a mob if a clear location isn't found
forcespawn: false
#4 = nighttime, what light level should mobs spawn in
lightlevel: 4
#Chance mobs will have armor/sword, 1 being diamond every time
armor-chance: 30
mobs: #More types of a mob, more likely it'll spawn(ONLY IN NORMAL WORLDS!)
- zombie 5
- skeleton 3
- creeper
- enderman
animals: #More types of a mob, more likely it'll spawn(ONLY IN NORMAL WORLDS!)
- pig 4
- sheep 1
- cow 6
- chicken 2

#This option disallows the placement of too many tnt-minecarts
tnt-minecart:
enabled: true
max: 2
radius: 6

#This option reduces global dispenser rate
dispenser-reducer:
enabled: true
time: 50

#This option reduces the explosions of mass amounts of tnt, and reduces tnt lag
tnt:
tnt-reducer: true

#This option reduces fire spread rate
firespread-reducer:
enabled: true
time: 1000

#How many entities should one chunk be allowed to hold?
chunk-entity-limiter:
enabled: true
limit: 10

spawn-limiter:
enabled: true
interval: 15
monsters: 20
animals: 20

#Meters your TPS, if it goes to low, run the commands you wrote below!
tps-meter:
enabled: true
interval: 15
tps-trigger: 14.0
commands:
- 'lagg killmobs'
- 'lagg clear'
- 'lagg gc'
- 'lagg unloadchunks'
- 'co purge t:9999999999999999999999999999999999m'

#This is /lagg killmobs, put what you DON'T want removed! 
kill-mobs:
disable-build-wither: false
mob-filter:
- Villager
- Wolf
- Horse

#This takes care of mob spawners
# -- max-spawn is the max entities that can be within the check-radius
mobspawner:
enabled: false
max-spawn: 4
check-radius: 15

#No longer bugged! -- Dont use if you have CB++ or Spigot!
item-merger:
enabled: false
radius: 6

#Auto-removal options
# -- warnings works like this; time = the time warning should be given, msg = warning message at that time
# -- NOTE: The below 'remove' section applies to this remover!
# -- NOTE: Putting the interval to low will cause issues!
auto-removal:
broadcast-message: ''
broadcast-warning: false
enable-scheduler: true
autoremoval-interval: 230
warnings:
- time:400 msg
- time:440 msg 

#What should be removed during an auto-removal
remove:
world-filter:
- this_world
broadcast-removal: true
boat: true
falling-block: true
experienceOrb: true
painting: true
projectile: true
item: true
itemframe: false
minecart: true
primed-tnt: true
arrow: true
snowball: true
fireball: true
ender-signal: true
item-filter:
# - 264
# - 265
# - 311
# - 312
# - 266
remove-mobs:
# - cow

#What should be removed during /lagg clear 
command-remove:
world-filter:
- this_world
broadcast-removal: false
boat: true
falling-block: true
experienceOrb: true
painting: true
projectile: true
item: true
itemframe: false
minecart: true
primed-tnt: true
arrow: true
snowball: true
fireball: true
ender-signal: true
item-filter:
# - 264
# - 265
# - 311
# - 312
# - 266
remove-mobs:
# - cow

check:
world-filter:
- this_world
boat: true
falling-block: true
experienceOrb: true
painting: true
projectile: true
item: true
itemframe: false
minecart: true
primed-tnt: true
arrow: true
snowball: true
fireball: true
ender-signal: true
item-filter:
# - 264
# - 265
# - 311
# - 312
# - 266
mobs:
creature: true
animals: true
monster: true

limit:
enable-limit: false
max: 1000
check-interval: 60
broadcast-message: '&6[ClearLag] &aLimit reached, removed +RemoveAmount Entities!'
world-filter:
- this_world
broadcast-removal: true
boat: true
falling-block: true
experienceOrb: true
painting: true
projectile: true
item: true
itemframe: false
minecart: true
primed-tnt: true
arrow: true
snowball: true
fireball: true
ender-signal: true
item-filter:
# - 264
# - 265
# - 311
# - 312
# - 266
Spoiler - LaggRemover Config
# The number at the end of the of each line is how much enabling this is going to improve server performance compared to other features
# The numbers are on a scale of 1-10
# All features are enabled by default

#Automatically removes loaded chunks in worlds that have no players every 10 seconds(9)
autoChunk: true

#Removes spawn chunks for all worlds in your server(10)
noSpawnChunks: true

#Smart lag detection. If a player types "lag" or "lagg" in the chat and your server TPS is less than this number, the server will perform its lag removal protocol.
TPS: 18.00

#This is the protocol id that you want executed by the smart lag removal tool. PROTOCOLS: clear_items, warn_clear_items
lag_protocol: clear_items

#Item clearing cool down. This is how long the smart lag detection has to wait until it can run its protocol again. Time is in minutes!
protocol_cooldown: 1
Just try to copy those config files. For the other plugins, just leave the configs as default :) or you can edit it tou your likings.

Run these commands.

Commands
- '/lagg gc'
- '/lagg clear'
- '/lagg unloadchunks'
- '/co purge t:9999999999999999999999999999999999999999999999999999999999999999m'
- '/killall all'
- '//clearhistory'
- '/lagg killmobs'
- '/lr clear'



OK! We're almost done :). Now we need to delete junk files. Please delete these

/world/playerdata (DO NOT DELETE FOLDER JUST FILES)
/world/playerdata (DO NOT DELETE FOLDER JUST FILES)
/logs
/plugins/EnjinMinecraftPlugin/logs
/plugins/NoCheatPlus/<logs> (DELETE EVERYTHING EXCEPT config.yml)
/plugins/Essentials/playerdata (DELETE FOLDER, IF YOU DON'T WANT TO, LEAVE IT)
/plugins/NoProxy/logs
/plugins/GAListener/GAL.db
/plugins/GAListener/signs.yml
/plugins/GAListener/uuids.yml
/usercache
/wepif




...if I missed anything just delete all the uneccessary stuff a plugin logs

JAR



The .jar of the server is very important I recommend using PaperSpigot as it is better than Spigot. It has gameplay fixes and bug fixes Spigot doesn't have. The link can be found here - http://tcpr.ca/paperspigot

You should use PaperSpigot-1.8.3 as it has security fixes older versions doesn't have


~123keelos
Tags

5 Update Logs

Update #5 : by 123keelos_ 05/16/2015 9:26:19 pmMay 16th, 2015

  • Better guide
  • Re-written

  • Fixed layout
  • Fixed some mistakes
  • Real-Time .yml interacting
  • New steps
  • ..and more to much too list ;)
LOAD MORE LOGS

Create an account or sign in to comment.

1
07/19/2018 4:12 pm
Level 10 : Journeyman Miner
mr_coffee1026
mr_coffee1026's Avatar
Not real sure about the crop growth thing... changing the chunks-per-tick did not seem to change growth rates at all... so setting the growth modifiers just made crops grow REALLY fast. I don't know if that might be partly due to changing the ticks-per-tile to a fifth of its original value or not, but that might be part of it. Its also possible that spigot patched something later to where it compensate for the "chunks-per-tick" setting before the growth modifier is applied but I'm not sure. In any case, excellent suggestions, thanks!
1
05/21/2015 10:04 pm
Level 9 : Apprentice Miner
braxtongreco
braxtongreco's Avatar
Can you provide a download link to the 2 .yml files? I tried it all and now my server keeps crashing.
1
05/22/2015 3:08 pm
Level 40 : Master Herobrine
123keelos_
123keelos_'s Avatar
1
03/21/2015 10:12 pm
Level 2 : Apprentice Miner
Azmidium
Azmidium's Avatar
This worked great! I have 1 GB of ram and I was using up to 800MB with this tutorials and everything that you said I got it down to like 350MB! SUBSCRIBE!
1
03/23/2015 1:11 pm
Level 40 : Master Herobrine
123keelos_
123keelos_'s Avatar
Thx for the comment. I will be adding more tips since I found new ones.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome