[1.16.4] Lag when there are a lots of auras in a big area
mmis1000 opened this issue · 6 comments
Mod Version
1.16.4-1.8.6 (in Direwolf 20 1.16.4 - 1.5.1)
What happened
we spawn a lots of auras in the server with setup like this (use the mekanism to generate mossy cobblestone infinitely)
And the server lags very seriously for some reason even we already literally remove every block in the loaded chunks.
The problem
We profiled the server with the spark
profiler.
And it turns out.
The natures aura cause big lag when there are a lots of aura in the near by area.
It use 20s in 60s on Ryzen 3900x.
It is giant amounts of cpu power as regards 3900 is a high frequency x86 cpu.
It may be even worse in most of setups (vgpu of vps, core i5, whatever).
https://spark.lucko.me/#5zG1urtoxG
The performance profile suggests a lot of time used in de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk.getLowestSpot()
, de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk.getSpotAmountInArea()
and so on.
Probably loops across all aura chunk in the server is not a good idea when there are a lots of them.
It would be great if you could test this exact setup using this version and let me know two things:
- Does everything actually still work as intended? (ie did any gameplay change)
- Is the performance improved? (you can just attach another profile for this)
If everything still works and the performance did in fact improve, then I will publish an update shortly.
https://spark.lucko.me/#yRCgd8Qxbk
Didn't seems to do anything. Still lag.
And for unknown reason, It seems performs even worse now.
The world we encountered this problem (Direwolf 1.16.4 - 1.5.1)
The lag spot is at nether (29, 77, -92)
https://drive.google.com/file/d/1ke_k9SaMmoxgIEoARuUFRNyI6rmQFpmn/view?usp=sharing
I checked out your save. For the amount of aura you added to this area (it was probably chunkloaded for a very long time?), the lag is.. very minor. When doing my own profiling tests, the amount of lag caused by the aura in the area is an amount that is definitely to be expected.
You should probably check out the Aura Detector, which is a device that you're supposed to use to disable aura generation after a certain threshold is reached.
Also, if you want to undo the amount of aura that you added, you can use the /naaura reset
command, which resets any aura in a radius of 35 blocks.