Minecraft Experimental - aesser11/home-lab GitHub Wiki

bedrock:

docker template modifications:

  • Name: minecraftbedrock
  • ServerFiles: /mnt/user/apps/docker/appdata/minecraftbedrockedition
  • UID: 1010 (minecraftbedrocksvc)
  • GID: 100

bedrock server setup checklist

ops.json

add usernames

whitelist.json

add usernames

server.properties

change from defaults

server-name=minebedrockgoblins
max-players=32
player-idle-timeout=0
max-threads=20
online-mode=true
white-list=true

possibly change in the future

view-distance=10
tick-distance=4 [4-12]
compression-threshold=1 [1-65535]

set this if config allows

motd=snarf snarf

custom launch parameters (experimental)

  • currently used ${EXTRA_JVM_PARAMS}

-server -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

  • Xms and Xmx size 10240

screen -S Minecraft -L -Logfile ${SERVER_DIR}/masterLog.0 -d -m ${SERVER_DIR}/runtime/${RUNTIME_NAME}/bin/java ${EXTRA_JVM_PARAMS} -Xmx${XMX_SIZE}M -Xms${XMS_SIZE}M -jar ${SERVER_DIR}/${JAR_NAME}.jar nogui ${GAME_PARAMS}


TPS (tick per second) lag troubleshooting

IN-GAME CAUSES OF TPS LAG

In-game, there are a bunch of different things that can contribute to server load. If you're going on a lag-busting binge, here are some things to keep in mind:

Repeating command blocks that are set to store their most recent output packets cause more lag than ones that are not set to store their most recent output.

If you have more than 64 block updates in a single chunk in a single tick, the game sends the whole chunk to be updated. Don't put a lot of fill-clocks in the same chunk.

gameLoopFunction runs every single tick and can be taxing, even if you're just using it for a simple mob head function. I recommend not using /gamerule gameLoopFunction at all for things like that, but instead making a simple clock in spawn chunks like this: https://www.youtube.com/watch?v=91MUm9qgRXQ and running the function file that way (run the function from the command block that the tutorial has creating an explosion particle). (I know for a fact that this workaround may have issues with spigot, be warned).

Lighting updates are incredibly laggy. Try to make sure your redstone circuits with pistons, rs torches, repeaters, and comparators are all well lit to reduce these lighting updates from happening in your circuits. Don't have a lot of unecessary flashing lamps, either.

Large numbers of fluid updates can be laggy while they are happening.

Hoppers will constantly seek item entities to suck in unless there is a CONTAINER above it. Regular solid blocks will NOT stop this seeking. I recommend using DROPPERS to cover all long hopper chains, to prevent this extra item-seeking method from running every single tick for each hopper. Furnaces are not recommended anymore, as they themselves get ticked, whereas droppers do not. See: https://www.youtube.com/watch?v=8s7S-xFVZcg Also note, item entities floating on the ground will check (an extra time!) with every hopper in the same subchunk (16x16x16 area) as it to see if it should be sucked up, even if the hopper cannot take it. In this way, item entities on the ground and hoppers together can cause more lag than each on their own. It is best practice to make sure that as few item entities are left lying around as possible!

Entities, especially ones with AI, are probably the single laggiest thing in the game, and the single-most-common cause of massive server lag that most people experience. To see how many entities there are in an area, press F3 in-game and look at the fourth line, left-hand side: "E: #/#". The first number is the number of entities within your field of view, and that includes seeing through walls. The second number is the total number of entities loaded around you. Entities include: mobs, minecarts, boats, item frames, players, items, xp orbs, etc. - basically anything that is not a block or tile entity. Large numbers of entities WILL cause the game to lag.

If you know you're going to have large numbers of a particular mob in farms, constantly colliding with one another (doing that jittery little dance), you can remove specific mobs' ability to collide with each other by implementing a scoreboard team option for those entities. I recommend watching xisuma's video about it here: https://youtu.be/IR-sR1HVSYA?t=17m30s. Do note, that if you enable this fix for some mobs, those mobs will NO LONGER CRAM themselves to death via maxEntityCramming if they become too numerous, so applying this "fix" universally to certain mob types (like chickens or villagers, for example) could cause much larger lag problems if the mobs reproduce out of control. I recommend applying this fix only locally to farms you have confirmed will not reproduce out of control.

Entities with duplicate UUIDs will cause the server to lag severely. These are most frequently caused by bug https://bugs.mojang.com/browse/MC-119971, and are only visible in the server console. They appear in the server console as (for example): "Keeping entity minecraft:villager that already exists with UUID 95bbe5ba-ff0e-46bc-a22f-a040dfd7572c" and "fetching addpacket for removed entity" spam in the console. The only way to resolve this is to use the /kill command targeted at the UUID from the warning (so, for the example mentioned, it would be "/kill 95bbe5ba-ff0e-46bc-a22f-a040dfd7572c" without the quotes), and repeat the command until the game tells you that the target cannot be found.

Perhaps at-first counterintuitively, being in a well-conditioned area causes more resources per tick to be spent on the mob spawning algorithm than would happen in a less-well-conditioned area. If the mob cap is not reached, then the mob spawning algorithm keeps making attempts to spawn mobs in each chunk, as it keeps failing over and over again. However, do keep in mind that the resources used by this process is significantly less than the resources the mob entities themselves would use if you were at the mob cap.

The act of generating new terrain is incredibly stressful on the server, especially if the player is moving quickly (like flying with elytra). Some administrators like to pre-generate a large amount of terrain before opening the server to members, or while all members are offline, in order to reduce the stress on the server while people are trying to play.

There is a bug regarding the dat files in the "world/data" folder: https://bugs.mojang.com/browse/MC-33134. These files are the ones that store map item data and structure data. The structure files contain massive NBT structures with data on every structure piece of every natural structure in the entire world, which is highly inefficient in terms of memory usage. These files, in large quantities and sizes, can cause some lag on their own, as they get loaded into memory in their entirety when called on. The Minecraft structure files will balloon in size over the course of a normal world's life. If you delete these files (as some people recommend), then the structures that have already generated in your world (like witch huts, ocean monuments, and nether fortresses, for example) lose their special properties (and thus will no longer spawn the special mobs like they should). Deleting map files will break in-game maps if they are being used by your players. I seriously do NOT recommend deleting any of these dat files, even ones like Mineshaft.dat, unless you absolutely have to. It could end up breaking future functionality in your existing structures even if it doesn't break anything today. If your structure files are large and/or your world has many maps, I recommend allocating more memory to the server to compensate if you are able.

references and additional notes


itzg has the most popular minecraft docker images