Tips for reducing server lag on tiny home server?

  • 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

ScottulusMaximus

New Member
Jul 29, 2019
1,533
-1
1
It was overloaded "-Xmx4G and -Xms4G" is allocating his entire RAM supply to Java, hence his issues... He then tried to run a RAMdisk on top of all that which is why it got worse. Presume it's fixed after my last comment cos he hasn't been back
 

GreenZombie

New Member
Jul 29, 2019
2,402
-1
0
ffs.
why do people spread misinformation about permgen like this.
Allocating more space to permgen can only worsen performance. Java either has enough space to store class data, or it doesn't. In which case it crashes with a very obvious error mentioning that it is out of permgen space. If you get that message, you increase the permgen: The default is 64m, so -XX:MaxPermSize:128m will probably cover most permgen space requirements induces from having mods-o-plenty.
If you don't get that error, you leave the setting the hell alone (or reduce it if it was previously raised "in error"), and let Java allocate its VMs memory to application heap, which is where its needed.

The question I havnt seen answered is, what OS, and what Java? Are both 64bit?
And what is the lag like if you start a world with no mods at all? Other than, perhaps, opis, because a lot of server lag can be derived from tps latency. Ive had servers lag out because, within 100m of spawn there was a village hiding in a jungle that had accidentally made an effective villager breeder. Opis will help show any issues caused by entities breeding out of control.
 
Last edited:

ljfa

New Member
Jul 29, 2019
2,761
-46
0
If you're using Java 8 the permgen option is deprecated. No need to worry about that then.
 

NunoAgapito

New Member
Jul 29, 2019
1,159
0
0
The question I havnt seen answered is, what OS, and what Java? Are both 64bit?
And what is the lag like if you start a world with no mods at all? Other than, perhaps, opis, because a lot of server lag can be derived from tps latency. Ive had servers lag out because, within 100m of spawn there was a village hiding in a jungle that had accidentally made an effective villager breeder. Opis will help show any issues caused by entities breeding out of control.

Pretty much this!! Opis, opis, opis.

Also, I had my 1st MC server in a dual core windows and oh boy.... CPU at 80-100%, lag all the time.... Switched to Linux, its a breeze. 10-15% CPU usage.

Keep in mind if the world is new, you might get some lag the first days as players explore and generate chunks! Once generated it will get better.

And stop asking if he has 64x versions. If he hadn't he would not be able to see more then 3Gb of memory and much less allocate 4Gb on Java...

Sent from my CUBOT ONE using Tapatalk
 

GreenZombie

New Member
Jul 29, 2019
2,402
-1
0
He could be passing -xmx4G - I don't know what 32bit java would do. Error out or clamp the parameter to a legal value?
 

ratchet freak

Well-Known Member
Nov 11, 2012
1,198
243
79
He could be passing -xmx4G - I don't know what 32bit java would do. Error out or clamp the parameter to a legal value?
it would crash immediately because 32 bit just CANNOT allocate more than 4 gig. Hell there is 65k reserved as invalid in win32 either way (to catch bad pointers)
 

NunoAgapito

New Member
Jul 29, 2019
1,159
0
0
He could be passing -xmx4G - I don't know what 32bit java would do. Error out or clamp the parameter to a legal value?
On a 32 bit OS you will not see more then 2.5-3 GB if RAM since the rest is used to store the addresses for all the machine devices. The more video Ram you have on your graphics card the less memory you will have available since it also needs to be addressed.

If the OS doesn't have the 4Gb, java can't allocate it and will crash.

Even if the OS is 64x and has more than 4Gb available, if Java is 32 bits, it can't allocate 4Gb since he would had to map the 4Gb and also map the 'internals' of Java.

Sent from my CUBOT ONE using Tapatalk
 

ratchet freak

Well-Known Member
Nov 11, 2012
1,198
243
79
On a 32 bit OS you will not see more then 2.5-3 GB if RAM since the rest is used to store the addresses for all the machine devices. The more video Ram you have on your graphics card the less memory you will have available since it also needs to be addressed.

If the OS doesn't have the 4Gb, java can't allocate it and will crash.

Even if the OS is 64x and has more than 4Gb available, if Java is 32 bits, it can't allocate 4Gb since he would had to map the 4Gb and also map the 'internals' of Java.

Sent from my CUBOT ONE using Tapatalk
you are confusing physical and virtual memory, a 32 bit OS can easily allocate 4 gig virtual memory to an application if there is a paging file available, (win32 only allows 2gig by default and reserves first and last pages)

part of the virtual memory is (typically) reserved for the runtime library and a trap page where the null pointer points to.
 

GreenZombie

New Member
Jul 29, 2019
2,402
-1
0
you are confusing physical and virtual memory, a 32 bit OS can easily allocate 4 gig virtual memory to an application if there is a paging file available, (win32 only allows 2gig by default and reserves first and last pages)

part of the virtual memory is (typically) reserved for the runtime library and a trap page where the null pointer points to.

A 64bit OS can allocate 4gig virtual memory to a 32bit process. A 32bit OS can't.
 

NunoAgapito

New Member
Jul 29, 2019
1,159
0
0
A 64bit OS can allocate 4gig virtual memory to a 32bit process. A 32bit OS can't.
YES IT CAN, it can't put it all on physical ram at the same time but that is what paging is for
You need to realize that when you tell Java to allocate 4Gb you are telling him he can allocate 4Gb to the application he is running, but the Java process will need to allocate 4Gb plus the memory for Java to run, so... it will fail!

This has nothing to do with physical or virtual memory, is has to do with using 32 bit to address memory positions and with 32 bits you can only have 4,294,967,295 possible addresses, so... you cant use more then 4Gb and you will need to address the 4Gb plus some internal shenanigans Java uses.

If by any reason Java 86x lets you do this, run away from it since it will be using some voodoo to be able to work and it will hurt performance and might not be stable!
 

ratchet freak

Well-Known Member
Nov 11, 2012
1,198
243
79
You need to realize that when you tell Java to allocate 4Gb you are telling him he can allocate 4Gb to the application he is running, but the Java process will need to allocate 4Gb plus the memory for Java to run, so... it will fail!

This has nothing to do with physical or virtual memory, is has to do with using 32 bit to address memory positions and with 32 bits you can only have 4,294,967,295 possible addresses, so... you cant use more then 4Gb and you will need to address the 4Gb plus some internal shenanigans Java uses.

If by any reason Java 86x lets you do this, run away from it since it will be using some voodoo to be able to work and it will hurt performance and might not be stable!
it's easy enough to simulate more than 4gig memory on a 32 bit app with manual paging using a memory mapped file, though it means that all memory accesses have to go through a software MMU which is slow
 

NunoAgapito

New Member
Jul 29, 2019
1,159
0
0
Can you guys get your foot on reality and stop talking about the hardcore ways of simulating something that is not needed and is not relevant to the OP?

He says he has 8Gb of RAM, so he needs to have a 64x OS. He also says he allocated 4Gb of RAM to Java, so, on a normal java client, it needs to be 64x Java. He also showed he doest have a deep technical knowledge of this area so I have no reason to believe he is using a 86x OS/Java + emulations and hardcore java parameters to run minecraft. That would be dumb!

One more tip to the OP, you will find many reports about MC and Java 7 having problems with 4Gb of allocated RAM. That the garbage collector will just gets a little nuts with so much memory and that you will get better performance with just 3Gb. Personally, from the mods you said and the number of players on server, 1.5-2GB would be enough to run it!