Having a very odd lag issue on one Minecraft server

Solution 1:

If no-one else but you is experiencing this problem, it might be that your client has not enough memory assigned, and is doing forced garbage collecting every few seconds to make enough room to keep running the game. (N.B. "Garbage collecting" is the process in which unused memory is freed up. Normally it is done when nothing special is going on. Forced garbage collecting occurs when the java application runs out of memory and has to free up memory to keep running).

In the client, go to the start-up settings of the particular version you are running, and add the following JVM arguments:

-Xmx2560M -Xms2560M

Xmx2560M tells the Java virtual machine to allocate a maximum of 2560MB of memory to run the application, which is about 2.5GB. Xms2560M tells the JVM to allocate exactly 2560MB when the application starts. You can set the Xms option lower, but never higher than the Xmx option. It does not help to set the Xmx option higher than the amount of memory that is available after the OS and other processes take their share. If you would allocate more memory, it would need to be swapped from the hard drive, which is a very slow process.