5

I'm running Minecraft on the following machine: Windows 8 x64, 8GB 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: My machine

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 which is setup exactly the same but running on a Intel Celereon (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, same world just on the other machine: Testing 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) occured 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 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...

So what do you guys say? Any idea why this happens and what I could do?

  • 3
    this game is written in java, you overload it with mods and you expect it to run smoothly? – DropDeadSander - EUW Oct 17 '14 at 14:42
  • What OS is running on the celeron? Possibly windows 8 bloat causing this? Can you try linux? – Johonn Oct 17 '14 at 14:48
  • I know @PhilippSander, but on the weaker system it runs with smooth and stable 60 FPS. It's my more powerful system which can't get it running smoothly! So in this case, Java isn't the problem. Both run, as mentioned, Windows 8.1 x64. And nope, I won't reinstall my OS nor install a second one. Moreover I don't believe it's the OS - it ran perfectly good back in January when I played last (on 8.1, too). And the weaker system runs 8.1, too, but without any lags. Must be something else :-/ – SharpShade Oct 17 '14 at 15:08
  • i't could be the graphics libary they used. NVIDIA is more supported than Raedon cards – DropDeadSander - EUW Oct 17 '14 at 15:11
  • But then it must be the rendering which takes too long, not the updates, mustn't it? The framerate drops because the graphics card don't get instructions fast enough. – SharpShade Oct 17 '14 at 15:13
4

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 the game and mods' 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):

  1. Revert to the low-resolution textures
  2. Lower your audio and video settings
  3. 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.

  • On top of the "Wait. I'm still writing..." you could do /save-off to disable world saving and check for a tick lag improvement. Of course this means more game held in memory instead of writing to disk. (Manually save with /save-all and enable with /save-on) – Barry Carlyon Oct 17 '14 at 15:05
  • Well, thanks, but none of these advices does apply to this situation. Please read my inital question carefully. I've written that the second machine is a lot less powerful in CPU as well as GPU. My system is way faster and I already enabled all Multi-Core stuff in Optifine. As to your suggestion of I/O: Both systems have their Minecraft files stored on a SSD, so writing can surely not cause any lags. Moreover I've set the save interval to 1 minute (or 3, not sure yet). It must be either a program which interferes or the CPU. Maybe Java has a problem with my overclocked CPU ...?! – SharpShade Oct 17 '14 at 15:06
  • /save-off is only for the dedicated server programs, not client-servers. (The server that runs when you play Single Player, or open to LAN) – aytimothy Oct 17 '14 at 15:17
  • With the mod "Optifine" you can change the autosave time from (correct my if i'm not right) 2 seconds to 30 minutes (and off). – nelson2tm Oct 17 '14 at 15:28
  • @nelson2tm, he is talking about his single player world; client-server (that has mods on it), not a dedicated server. Also, the BetterLAN Mod; one that uses Bukkit as a client-server only supports up to 1.6.2; he is using 1.7.10. – aytimothy Oct 17 '14 at 15:31
0

Have you recently overclocked your monitor? If so, change the refresh rate back to it's original state. It worked for me so if this is your scenario then it will work for you.

  • No, I don't see any reason for overclocking my terribly old monitor... – SharpShade Aug 7 '18 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.