The lag - I hate it. Tips for lag reduction?

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

BarningOwls

New Member
Jul 29, 2019
63
0
0
I guess there are different types of lag. The one that tortures me most is the one where you try to place a block and it sets down two or three.

It almost ruins the game for me.

I think our server is pretty young and healthy. Nobody is running any machines at the moment, and we banned chunk loaders.

Do you guys get this too? What can I do to prevent it?
 

ShneekeyTheLost

Too Much Free Time
Dec 8, 2012
3,728
3,004
333
Lost as always
Get more bandwidth for your server or for the computer you play on. It has nothing to do with the mods at this point, it's a problem which exists between your computer and the server the Minecraft world is being hosted on.

If others experience this problem, it's the server. If they don't it is your internet connection. Try pinging your server and see what kind of time you are looking at.
 

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Install Optifine. Use the lowest settings. If it is server side I dunno, I've never ran a server correctly.
 

BarningOwls

New Member
Jul 29, 2019
63
0
0
It's either my computer or the server. I know others complain about lag, but I don't know if they have the same kind as me. I do have optifine, and it is wonderful. I love optifine.

It might be my computer though. I'm playing on a laptop. Its a very good one, and only a couple years old. But it is a laptop.

What about things I could do in-game? Are there things that cause lag? And what can I do about them?
 

Enigmius1

New Member
Jul 29, 2019
499
0
0
Okay wait...let's just slow down the diagnostic mobile and get one thing sorted out.

It's the server.

Unless you're running FTB on a toaster, your PC is not going to be the cause of the kind of lag that places three blocks simultaneously. If that were the case, we'd be seeing all manner of people reporting the same thing. If it was your PC struggling to play FTB, it would manifest itself with low framerate and/or stuttering frames.
 

Silent_007

New Member
Jul 29, 2019
302
0
0
Unless you're running FTB on a toaster, your PC is not going to be the cause of the kind of lag that places three blocks simultaneously.
Well, that can happen - it happened to me on my old laptop. I double-placed blocks around 25% of the time on there, and that was in vanilla.
But yes, it was essentially a toaster. My frame rate was always in the single digits.

So if the computer itself is the problem in the OP's case, I agree that frame rate would probably be an even bigger concern.
That said, it still may not be the server. It may be a connection speed issue.
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
I never used to get the multi-block placing thing, then 1.3 came. Now I get it even in single-player. Along with all sorts of other "communication errors" that really shouldn't plague a single-player world, such as mobs drifting through walls, items that don't de-spawn until I leave the area and come back, and chunks that don't visibly load.

Hence when those things happen online I'm less inclined to blame lag and more inclined to blame the underlying game code. Needless to say I'm not a great fan of "the merge".
 

ILoveGregTech

New Member
Jul 29, 2019
788
0
0
Close other programs when using FTB
Add Java parameters to your advanced settings.
Install Optifine
Use lowest settings on Minecraft
Make sure you don't have too much automated stuff.
Also, Happy Mother's Day! :D
 

Zjarek_S

New Member
Jul 29, 2019
802
0
0
Also, are you sure that all chunkloaders are disabled? Quarries and MFFS blocks also load chunks. You can use /chunkloaders or similar command to see exactly what areas are chunkloaded.
 

SatanicSanta

New Member
Jul 29, 2019
4,849
-3
0
Also, are you sure that all chunkloaders are disabled? Quarries and MFFS blocks also load chunks. You can use /chunkloaders or similar command to see exactly what areas are chunkloaded.
And that, my friend, is the problem with banning chunkloaders.
 

dlord

New Member
Jul 29, 2019
147
0
0
Disclaimer: I am answering this post with multiplayer in mind. This is only applicable when your server is located somewhere in the internet.

This post may be TL;DR for some people. In which case, skip to The Workaround section.

More bandwidth is not enough.

Connection with low latency is not enough.

Why? let me explain...

When Mojang updated Minecraft to 1.3, the single player became a multiplayer game, thus unifying the client and the server. It's both a good thing and bad thing.

The good thing is that bugs that are specific to multiplayer and single player are significantly minimized. Mods also became universal: no need to download separate packages for the client and server. Multiplayer-compatible mods became the norm.

But it all came with a cost.

When our private server upgraded from 1.2.5 to 1.4.x back in December, we noticed that some of our users who used to not get any lag had a bad experience. At first, we dismissed it as a connection problem on their side (after all, our ISP here is known for bad service on certain areas).

By March, all of us were experiencing significant lag, even if there was only 1 person on the server. That prompted us to track down the problem. Based on our observations, here's what we found out:
  1. On multiplayer, the Client and Server sends a lot of packets to each other. Much more than what it used to be before the 1.3 update. On an area without any machines running, you can have 40-50 packets/sec for incoming and outgoing traffic. On a busy area, you could have 70-100 packets/sec. This is an indication that there is a lot of network chatter between the client and the server.
  2. Data being sent between the client and server is much larger than pre-1.3. Even on a vanilla Minecraft, the amount of data is significant. Unfortunately, I don't have the exact numbers with me.
  3. When we play from outside the office network (yes, our office has an official Minecraft server), we observed a lot of dropped packets and resends from the client. Which leads to more packets sent from the client (practically double the amount the server sends). Which translates to more bandwidth being used than normal. We tested this even on vanilla Minecraft. If we play within the office network (LAN), no lag issues whatsoever.
We are not certain as to why we are getting dropped packets. We haven't done enough testing yet to come to a conclusion. But we know how to workaround this.

THE WORKAROUND


If we want to play on our server from outside the office, what we do is create an SSH tunnel with compression enabled. With this, you minimize the data being sent and received, making the whole thing more efficient while minimizing lag. This practically eliminates the packet resending issue.

If you want to use this solution, you will need an SSH account on the server you play. You will probably need to have special permission from the server admin to do this.

To create the tunnel, here's the command:

ssh -L 25565:localhost:25565 -C -c blowfish [email protected]


Before you get scared and run away, let me explain each part:

-L 25565:localhost:25565 is the parameter that says "create a local tunnel that connects the server's port 25565 to my local machine's port 25565". That port is Minecraft's standard port. You will need to change that if your server runs on a different one.

-C is the parameter that enables SSH compression.

-c blowfish is the parameter that forces SSH to use blowfish as its encryption algorithm. This should reduce the amount of CPU used by SSH.

[email protected] is your credentials to login to your server. Change it with the actual username and hostname (or IP address if your server doesn't have a domain name associated with it).

Once your SSH tunnel has been established, login to Minecraft, go to multiplayer, and connect to localhost.

Enjoy!
 

Quesenek

New Member
Jul 29, 2019
396
0
0
What are your download and upload speeds and what are your servers download and upload speeds.

Also:
what are the specs of the server PC
What OS are you running the server on
what is the TPS/Average tick if you don't know how to get the TPS

All of this will help track down the problem and every single one of the things I asked for could cause lag somehow for the users of the server.
 

Xaviorm

New Member
Jul 29, 2019
23
0
0
ssh tunnels to fix lag = face/palm.

If your dropping packets try tuning your tcp stack to match your upstream. Unless you know how to break down network traces to check what is being requested and what is being sent this is probably not an option.

Also increase the amount of cores that the server is using. I/O is one of the few places that MC actually benefits from threading by default.

double placing blocks is almost always a networking issue which can be caused by:

a) Your machine not having enough ram and swapping thus making your hard drive too active. This can interfere with your ability to handle packets.

b) The router/firewall you are going through is too busy or needs to be rebooted or replaced. Or you need more upstream.

c) Your server is too busy to handle them. This often happens on my server when backups are compressing.

d) The server is being DOSed. (it happens)

e) Your ISP is not doing it's job well.


As far as lag/server performance at end game, you just have to be a good admin. People will over build and kill off your TPS. it's the admins job to control what can and can't be done on server. Also check out MCCP+ and/or aperf. They can help. The Tick Threading mod may also be suggested although every time I have tested it there have been big enough issues that we had to roll it back. I do keep hoping though.

Minecraft is probably one of the worst performing server apps I have ever run. It is what is is. You have to work around it's limitations.
 

dlord

New Member
Jul 29, 2019
147
0
0
ssh tunnels to fix lag = face/palm.

If your dropping packets try tuning your tcp stack to match your upstream. Unless you know how to break down network traces to check what is being requested and what is being sent this is probably not an option.

Also increase the amount of cores that the server is using. I/O is one of the few places that MC actually benefits from threading by default.

double placing blocks is almost always a networking issue which can be caused by:

a) Your machine not having enough ram and swapping thus making your hard drive too active. This can interfere with your ability to handle packets.

b) The router/firewall you are going through is too busy or needs to be rebooted or replaced. Or you need more upstream.

c) Your server is too busy to handle them. This often happens on my server when backups are compressing.

d) The server is being DOSed. (it happens)

e) Your ISP is not doing it's job well.


As far as lag/server performance at end game, you just have to be a good admin. People will over build and kill off your TPS. it's the admins job to control what can and can't be done on server. Also check out MCCP+ and/or aperf. They can help. The Tick Threading mod may also be suggested although every time I have tested it there have been big enough issues that we had to roll it back. I do keep hoping though.

Minecraft is probably one of the worst performing server apps I have ever run. It is what is is. You have to work around it's limitations.

Yes, I admit that it's not the best workaround. But then again, solutions to a problem may not necessarily make sense. LOL

For one, I'm not a networking guy, and I prefer not to tune my OS anymore (used to do that a lot with Windows). Our sysad suggested it might be related to MTU, but like I said, I don't want to tinker around with it. And we haven't gotten around to pinning down the cause.

The ssh trick is a quick and dirty solution that anyone can try.
 

KirinDave

New Member
Jul 29, 2019
3,086
0
0
ssh tunnels to fix lag = face/palm.

Don't be a dick. It's contraindicated, but if it worked it addressed their specific problem.

Surely it wil not work in general though. SSH connections will only have higher latency than a pure tcp socket.

P.S., do you use SSH a lot? Does console lag bother you? Do you hate losing connections due to inactivity? Mosh will blow your damn mind.
 

dlord

New Member
Jul 29, 2019
147
0
0
Don't be a dick. It's contraindicated, but if it worked it addressed their specific problem.

Surely it wil not work in general though. SSH connections will only have higher latency than a pure tcp socket.

P.S., do you use SSH a lot? Does console lag bother you? Do you hate losing connections due to inactivity? Mosh will blow your damn mind.

True, there's latency involved due to the overhead introduced by the protocol. But if latency's good enough (< 280ms), you'll live.

Your choice: more resent packets, or higher than normal latency.
 

Xaviorm

New Member
Jul 29, 2019
23
0
0
Don't be a dick. It's contraindicated, but if it worked it addressed their specific problem.

Surely it wil not work in general though. SSH connections will only have higher latency than a pure tcp socket.

P.S., do you use SSH a lot? Does console lag bother you? Do you hate losing connections due to inactivity? Mosh will blow your damn mind.

It's not being a dick to point out a fail solution in a whimsical manner.

Let me go over some of the issues with using ssh tunnels for the average minecraft server owner.

1) Teach your users how to setup tunnels in putty. (yay the worlds most awesome ssh app. not). for the more advanced use cygwin and real ssh. The previous examples were for mac/linux for those following at home. If you run windows you get putty, cygwin or something you have to pay for.

2) Manage logins. Keys if you want extra fun.

3) You are opening a big fat hole through your firewall for anyone to do anything they want on your network. Unless you 100% trust your clients connecting, THIS IS A HORRIBLE IDEA. As in really really bad. = face/palm

All of this is assuming you know what you are doing on the OS side to limit the damage a person could do there. Could it be done and have your risk minimized sure. But not the way that was pointed out.

This is the same thing as hooking up Himachi and making a private vpn. If you are ok with making big holes in your private network then hey go for it but I would not ever recommend anyone doing this on a home network with strangers playing on your server. A VPS hosted by professionals maybe.
 

Bigglesworth

New Member
Jul 29, 2019
1,072
0
1
Xaviorm, his solution is 1000x times better than your non existent one. Blindly poking at what amounts to 'have you turned the server on off and on again' and tell your users not to build as much?