# Reducing Server Lag

## How can we minimize lag on the server? Together we can create a lag-free survival server, but it takes everyone's help!

## Introduction

Lag is not caused by one person, it is caused by all of us. Some of us cause more than others, but we can all do small things to reduce the amount of lag we cause. Remember: do not ever accuse anyone else of being the problem. If you believe someone’s build or behavior is a large contributor to the lag, please privately tell a staff member so we can look into it. If you have any specific questions, staff are always here to help. This is especially true if you want to make a redstone contraption, but are unsure how to have it automatically shut off when not needed or to make it less taxing on the server.

## Mobs

Mobs are the #1 cause of lag on a survival Minecraft server. They can be surprisingly hard on the server and are a cause of lag that everyone contributes to. Because of this, never keep more than you need of any given mob.

FarmLimiter is a plugin that introduces hard limits to mobs. The plugin groups mobs by chaining mobs together that are within a minimum radius of each other. Please refer to the example image for a better idea of how mob chaining works. We've provided the settings of this plugin below for your reference, but please do not try to circumvent this system - it is in place for a reason!

- Villagers should not be allowed to build up from a breeder, and you should cull undesirables as needed to keep your numbers as low as possible. Also think carefully about which villagers you really need and if you can make dual use of some. Only use “infinite” villager breeder designs if you limit their breeding by limiting their food.
- Villagers used for trading should be put on emerald blocks, emerald ore or smooth stone. This will disable their AI for anything other than trading. This helps server performance a lot and any villagers used for trading found without their AI disabled could be removed by staff if they are causing lag. Villagers placed on these blocks will refresh their trades faster than normal. The following example visualizes the 20 passive mobs within 5 blocks FarmLimiter restriction. Show example...

- Turtles only need one breeding pair. The breeding mechanic of turtles allows you to breed one pair over and over, as they become fertile immediately upon laying their eggs. Consider keeping only two adult turtles in your farm.
- Consider not raising pigs at all, as their meat is exactly the same as beef and they have no secondary drops
- Do not fill your base with more vanilla pets than you need
- Never circumvent entity cramming. It is there because a lot of entities crammed into a small space is hard on the server.
- FarmLimiter is a plugin that introduces hard limits to mobs. We've provided the settings of this plugin below for your reference, but please do not try to circumvent this system - it is in place for a reason!

### Farm Limiter Plugin

No more than 25 mobs (of all types) within a radius of 3 blocks (this gets the chickens).

No more than 20 passive mobs within a radius of 5 blocks (limits farms - including villagers and excluding chickens).

No more than 10 hostile mobs within a single block (limits grinders).

No more than 10 turtles within a radius of 5 blocks (turtles cause a LOT of lag).

No more than 70 villagers within a radius of 50 blocks.

## Minecarts

Minecarts are another type of entity that cause a lot of lag. They are harder on the server than you might think.

- Do not store villagers or other mobs long-term in minecarts. Use them for transportation and drop them off in an enclosed location on the other end.
- Do not use farm designs that rely on many hopper minecarts. They are convenient because they pick up items through blocks and have a faster throughput than hoppers, but they are unnecessarily hard on the server.
- Avoid using minecarts for entity cramming purposes when possible and try to design your farm to only have one such killing chamber if it is necessary.

## Hoppers

Hoppers cause lag because they are constantly checking for items, even when nothing is in them, so you should minimize your use of them.

- When bringing items down through a vertical line of hoppers, try alternating them with single chests. This saves you iron and saves the server a bit of lag.
- Bulk storage systems where random items are dropped in and sent into chests should be avoided because they are likely to cause a situation that is especially taxing. More specifically: A hopper pushing items into a full chest that are not in the chest OR A hopper trying to pull items from a chest to complete stacks but none of the items in the chest match.
- Myth: Droppers/Furnaces on top of hoppers reduces lag. Droppers on top of hoppers do not reduce lag, and furnaces are a slightly laggy object in their own right, so do not use them unnecessarily.
- When moving items long distances use water streams. Also try to use water to gather newly farmed items rather than an array of hoppers. However, be aware that water streams have their own downfalls: First, the item entity is at risk to be picked up by a pet with /petpickup turned on. So, do not use them near public areas of your base or for high value items. Second, do not make water streams so long that they flow into unloaded chunks, as the items can back up where chunks unload and create a ticking lag bomb of item entities. Finally, set things up so that, if the storage system at the other end fills up, the extra items get automatically destroyed rather than sitting on full hoppers to despawn.

## Redstone Farms

Redstone contraptions are, by their nature, going to contribute some lag. But you can do things to reduce their impact.

- Biggers is not better. Try to make farms a reasonable size for what you need and no larger. Think about how much of a resource you actually need.
- Think about the design you use. If you have a farm with a lot of pistons to break crops automatically, can you set it up so that the pistons fire in sequence instead of all at once? Can you use a slimeblock push bar so that you only need one piston and one observer for every 12 plants instead of one per each? Minimize how much redstone is running at once.
- Set up your machines to shut off when not in use.
- If you use a minecart hopper/chest to transport items, make sure it automatically docks when there are no items to move. You can set up the minecart pickup to only run after a harvest and an auto-smelter that uses minecarts to fill the furnaces does not need to have the minecart running all the time, only when it’s dropping off items.
- Redstone clocks rarely need to run all the time. For example, an item disposal dropper can be set up to automatically trigger the clock when there are items in the dropper and to shut off the clock when the dropper is empty.

## Other Entities

You may have noticed a theme in this list. Everything we've listed is an entity. Entities are the biggest cause of lag on Altitude, and anything we can do to reduce the number of entities on the server will help!

- Block Entities. Any block entity causes more lag than a normal block, but some cause more than others. minecraft.gamepedia.com/Block_entity
- Signs with text on them are laggier than empty signs, so consider if you need to write that sign. Also, be sure to not write anything on signs used for technical reasons, like to hold back lava or water.
- Item frames also are a small contributor to lag, but can add up, so please do not use a lot of them for no reason.
- Brewing Stands cause more lag than you might think, so please do not have more placed than you need.
- Item Entities. Please pick up item entities when mining, even if you don’t actually want them. You can dispose of them by throwing them in lava or on a cactus. But leaving mass amounts of items to despawn puts an unnecessary strain on the server.