Insane tick lag in Minecraft [closed]
I'm running Minecraft on the following machine: Windows 8 x64, 8 GB RAM (4 allocated for Minecraft), i5-2500K @ 4.5Ghz, AMD Radeon R9 290.
I've got about 70 mods including Buildcraft, Thermal Expansion, and some other common technology mods. I haven't had this issue in earlier versions of Minecraft. As for Forge, I'm using 1226 (one of the latest builds).
Now when I play independent of which map and with or without mods, the game is running very patchy. I get an average framerate of 30 with Mods and ~60 without Mods. Though I have at least 30 FPS, the game stutters. This is caused by random lag spikes which occur all 1-10 ticks. Here a screenshot of my lag-o-meter and the profiler:
Like you can see, a lot of irregular spikes and very high tick times. Moreover, in Debug view I get every now and again a message that something is taking too long and "root" or "root.tick" or "root.render" or others took approx. 110ms.
Now as I'm curious I tested the same on a machine that is set up exactly the same but running on an Intel Celeron (2-cores) @ 3.2 GHz and with an Nvidia Geforce GTX 560 Ti.
The game runs perfectly smooth with all mods. The ticks are short and equal and I get an average of 60 FPS with Mods and highest viewing distance. Here take a look, the same world just on the other machine:
You clearly see the difference and the profiler shows that the ratio between Tick and Rendering is exactly the opposite to mine here.
Now does anybody know why this happens to be? I really don't get it. I've tried out all. Various Java parameters people suggested all over the web, tried Java 8, tried different Java versions, played around with the allocated RAM but nothing helped... It just doesn't run smooth and playing so is horrible.
I recently had a problem that randomly the menu's lagged and audio glitches (CPU frozen) occurred in Thief. Since that time I went down with the clock, though a lot of intense burn-ins said it would be stable. Now, these glitches didn't appear anymore, but I can't believe that Minecraft stresses the CPU so much that it's getting unstable... Moreover, I tried Terasology (maximum graphics settings) when the clock was still higher. It ran with a smooth 60 FPS and without issues. I tried it again a few days later and then it lagged the same as Minecraft did, just that Terasology sooner or later crashed with a "somewhat Delay" exception. I guess the same issue — unstable ticks.
All other games work just fine, without any troubles. It looks like it's just with Java games...
Solution 1:
Lag spikes are caused by three possible things:
Just remember, there are multiple ways to fix these problems, and multiple things that may be causing these problems.
- Too many packets!
Minecraft can only handle ever-so-many chunk updates in a single setting; tick. Because it cannot finish all the updates in that single 1/20 of a second, it freezes the world until it is able to complete the processing for that tick.
You can improve the amount of work it can do by getting a better CPU; processor (or giving Minecraft more priority over other tasks). RAM only allows you to have a greater workload; not go through that workload quicker.
Because the server and the client (if you're playing single-player) are both linked, your game freezes when it is unable to finish all the work (updating of data; the world OR rendering the world*) within the time frame of a tick (1/20 of a second).
* Note: More than 20FPS means more than one frame created in a single tick.
- Wait. I'm still writing...
When you have a Minecraft world, the game constantly saves the world to the disk (unless you've increase the interval that it does this) every 3 seconds. However, if the server is unable to write to the disk, it freezes the server to ensure that the data state that needs to be saved does not get changed. If it can save it in one go, of course - Everything will continue as per normal.
Pretty much, the only way to prevent this is to stop all, or at least the processes/tasks/programs hogging I/O capabilities in background that is reading to the disk, or get a better hard disk drive.
(i.e. Steam updating files, copy-pasting commands, saving school/home/work-work etc.; anything involving reading and writing to a disk)
- Inefficient coding, AKA. Bugs
Very unlikely, if not - Not even applicable here, but there may be bad coding in thegame andmods' codes that make it leak memory or constantly remember new things in memory without clearing out redundant values.
Though some of the large mods are known to do this, and most of them by now have already fixed most (if not, all) problems causing spikes in memory usage. The only way is to solve this is to fix the coding yourself, if the source code is released.
If all else fails (without uninstalling/modifying the mods you have):
- Revert to the low-resolution textures
- Lower your audio and video settings
- Close ALL other tasks other than Minecraft.
because it most likely because your computer can't handle it.
I could continue with how Java is an emulated system (virtual OS inside a running OS) and how emulators run slower because it needs to emulate a system architecture that is completely different to those of a PC/whatever device, but that's not the point.
Minecraft runs on Java, which requires a virtual machine to be emulated inside your computer. Because of that - Emulation takes more memory and CPU processing power than it usually needs (if you were to run it on the native OS).
The reason other games worked is because they are native to Windows; don't need to go through 5 other steps before a value can be changed or something can be outputted.