Lag types and how to fix them - Historical

Applied By shmoeface: Aug 26, 2016 at 3:36 PM

Lag types and how to fix them

Lag types and how to fix them




What types of lag are there?(top)

There are many people who are confused in regards to the types of lag and how to limit it. Overall, it can be split into 3 categories on what is causing lag. There is one, client lag, two, server lag, and three, latency (or internet lag).

FPS lag (client lag)(top)

As a player, you should be concerned with client lag. This lag is a direct result of the client. This means that this lag is caused by your computer running the Minecraft game. Client lag is affected by things like a large amount of entities (e.g thousands of dropped blocks or animals, and a few other related things, such as light values on structures running shader-packs, mods, etc). This will cause your FPS (Frames Per Second) to drop, and is the most common type of lag. When playing on servers this is reduced, as the game engine calculations are running on another computer (the server), minimizing the calculations your computer needs to run and therefore giving you, as the player, more resources to play the game. This is the only kind of lag that is affected by the quality of your computer.

Fixing FPS lag(top)

The Optifine mod can help a player to achieve higher FPS with the same quality. You can also make efforts to limit this by removing all the land in spawn worlds, so that it is a void world with only the spawn, or should your spawn reside withing the same world as the world to play in, you can use WorldEdit to fill the caves below with stone, to lower the amount of light-values to be calculated when a player spawns. You should also remove any unnecessary and fast-flashing redstone and any mobs close by, by using WorldGuard regions and flags to block mob spawning. Otherwise, you may just need to upgrade your computer hardware.

TPS lag (server lag)(top)

The next type of lag is server lag. This is described in Minecraft as TPS. TPS stands for Ticks Per Second. TPS is otherwise known as game ticks and is a maximum of 20. 20 TPS is hardwired into Minecraft as the universal speed. That is to say the smallest amount of time possible that is distinguishable from the games perspective. Each “tick” causes the game to recalculate directions of mobs, as well as other things such as growing crops. Just to get an idea of how long it is, each redstone tick is equivalent to 2 game ticks. This is incidentally also the reason redstone “half” ticks exist, being 1 game tick. Remember that TPS and FPS are different. TPS, on the server, is controlled by the speed and capabilities of the server. FPS is based on the players computer.

Fixing TPS lag(top)

TPS can be improved by lowering the strain on the server. This can be done in a number of different ways. Firstly, you can improve the hardware of the server, with more RAM allocated to Minecraft or a faster CPU. You can also make use of plugins, such as ClearLag, to clear entities, garbage collect chunks that are loaded and more to optimize your server. I also recommend using the WorldBorder plugin to limit world sizes and then generate it, so that the server does not have to generate chunks. Finally, you can also unload unused worlds and remove any unused plugins that can be taking resources.

Latency(top)

Finally, we get to Latency or Internet lag. Internet lag is usually a result of being geographically far from the server host. This means that the electrical impulses take many milliseconds to reach the server and then have to travel all that way back. This means there can be a lag between input from your computer to it appearing on your and other screens. Take the example of you placing a block in-front of your friend. Firstly you have to click to place the block, that information then has to travel up-to 20000 km (half of the circumference of earth (do not use the radius because internet cables are not laid out straight through the earth's inner core)) to the server. Then, this information has to be processed and sent out to your friend's computer, which might be up to another 20000 km away. Traveling this long distance can take a while, not because light is so slow, but rather because there are a lot of routers and relays your internet data has to pass through. Other kinds of internet lag can include bandwidth issues, common in the event of a DDoS (Distributed Denial Of Service) attack, where the server is bombarded with so many connections that it is unable to process normal connection. This is similar to how roads get slower and blocked with traffic when there is a lot of cars.