Applied Energistics 2

Applied Energistics 2

137M Downloads

big p2p network cause lag on blockupdates in same chunk

dskw opened this issue ยท 7 comments

commented

Note: Since this is a report for the last stable 1.10.2 and I'm not sure if you still give support for that, feel free to close the issue if this bug does not apply to the latest release.

Description

I have tried to rebuild the mass connection design from this video:
https://www.youtube.com/watch?v=bMU1scXth6M

The setup itself is ok, but whenever there is any (even ME-unrelated) block-update in the same chunk it causes severe lag.

I have created a small test-world with an example setup. The mass p2p network is not connected to the one causing the block-updates but it still causes lag. You can see the same (but smaller) effect even when hand-placing blocks.
Removing the mass-network removes the lag.
This applies to SP and MP.

Sadly I was not able to pinpoint the problem with jmc, jvisualvm or /forge tps since the lags itself are very small compares to the usual load of the Minecraft process.

World download:
http://minecraft.dskw.de/worlds/ae2-p2p-lag.zip (337 KB)

Environment

  • Minecraft Version: 1.10.2
  • AE2 Version: rv4-stable-1
  • Forge Version: 12.18.3.2511
commented

I've also tried it with rv5-stable-2, minecraft 1.12.2 and forge 14.23.0.2491:

The smaller network only has a minimal lag when starting all the furnaces, but when everything is attached to the big network the lag happens again.

But: The performance is much better than 1.10.
Note: Also this (1.12) was testes on a much slower machine than the original issue on 1.10.

Updated world for 1.12.2:
http://minecraft.dskw.de/worlds/ae2-p2p-lag-12.2.zip (336 KB)
Screenshot:
http://minecraft.dskw.de/worlds/ae2-p2p-lag-12.2.png

commented

Thats how minecraft works. Any update in a chunk will redraw the entire chunk. We did some optimization in the cable rending in 1.12 so that's why its much better there.
I see you only have 1G allocated for minecraft? Those lag spikes may come from garbage collection, try to increase the allocated memory.

commented

Yep this test with 1.12 was rather quickly done on my notebook, hence the default settings. But good to know about the rendering. Do you think a better solution would be to move the big controller structure into its own chunk and have everything else in other chunks? Or do updates to the network force a redraw of all connected blocks anyway?

I liked the idea of having my whole AE2 setup in a single chunk and keep it loaded, but if this is causing performance issues I can redesign it.

commented

What kind of lang are we talking about here? Even in 1.10 it shouldn't be that bad. Did you try changing gfx settings? Like disabling mipmapping?

commented

I'll try to create a screencap from the actual 1.10 problem when I'm at home.

The kind of lag I mean is this:
For any block that is placed or modified, like a furnace changing form "inactive" to "processing", the game freezes for a fraction of a second and a big red spike happens in the debug graph.
This is getting worse the more blocks are updated and I remember now this is not locked to a single chunk but all containing the ME System.

I noticed this with my first setup with a regular ME System and just 6 P2P subnets. One of them had two processing Systems with a chest that is fed into via interfaces/patterns and insert the result into an interface.
Each of these had 10 Machines attached via Conduits and processed items for crushing or smelting.
The Controller in that case was in a different chunk than the processing but it looked like all chunks with the ME System in it were affected by those freezes/lag.

When I started to process something with these machines the game was having these micro freezes every second and was unplayable this way.

I'll try to render a video later of the savegame I've attached to the initial report, showing the problem.
To make it clear:
The savegame was made with only AE2 installed, nothing else, to make sure this is not linked to any other mod.

I'll also test this out a bit more and try out the multi-core feature as well.
And thanks for the feedback so far!

commented

If it's FPS drops you're having you might want to consider enabling Forge's experimental multi-core rendering option.
If you're ingame you can toggle it in Forge's "Mod Options" page (check the Client tab), or edit it in forge.cfg in your config/ folder.

# Enable forge to queue all chunk updates to the Chunk Update thread. May increase FPS significantly, but may also cause weird rendering lag. Not recommended for computers without a significant number of cores available.
B:alwaysSetupTerrainOffThread=true

Other than that there's not really anything we can do. This is due to how Minecraft works really with a bunch of TE's in a single subchunk.

commented

Ok so it looks like you guys were right all along. It is just the rendering of MC that caused the delay. Heck I don't even know why but when I test it out right now it is even better than yesterday without changing anything.

Lastly enabling the multi core rendering as suggested by @GuntherDW caused all lag/delays to vanish instantly.

Guess I'll build a new modpack based on 1.12 now to also take advantage of all the optimizations done in AE2 by now.

I'll close the ticket, thanks to all of you for your feedback and help!