Performance review request - Enemy NPCS -
ProsperCraft opened this issue · 4 comments
Modpack - https://minecraft.curseforge.com/projects/ancient-towncraft/
The server is holding 4 TPS, and nobody is moving so no worldgen. Chunkloaders are disabled.
The world was just started a couple days ago, so no elaborate builds.
Spark(warmroast profile)
https://sparkprofiler.github.io/?DpdLMXayKC
Sampler nps file for visual vm
entities.zip
I had all players log out, which then increased tps to 9, started new profiles -
Spark-
https://sparkprofiler.github.io/?dBmWOo6k5i
sampler-
noplayeron.zip
After rebooting, the tps went to 20 with no players, 20 with two players, 6 with 3, then dropped to 0 with 7 players here are the stall reports-
stall-2018-09-08_10.56.05.txt
stall-2018-09-08_10.56.36-1.txt
It eventually recovered to 9 to 12 with six players.
Are you sure this is caused by enemy npcs? I just tried spawning about 500 of them and yes I am seeing that the tick tatkes 27ms to process but that's to be expected when there's that many entities around especially when they are colliding. But I am definitely not seeing any dramatic drops nor I can see anything when profiling.
Also I don't see anything bad from AW in the provided sampler files. The worst is 84s spent on updating npcs (both player owned and enemy/faction) out of 214s that were spent on updating all entities overall. That would be concerning only if there was just a couple of aw npcs in the world at most.
In the second spark profile -
net.shadowmage.ancientwarfare.npc.entity.NpcBase.func_70071_h_()45.71%
45% of the server -
https://i.gyazo.com/947bb7e28e17ab8557af2483b9f191b2.png
Is ice and fire causing a conflict with the dragon fear or something? Is that what I am reading?
So I am actually looking into this a bit more and using some of this data to optimize the code. But actually those 45% are spent on onUpdate method which then calls the onUpdate in the vanilla EntityLivingBase and if you drill down much further you will see that it the returns to calls to aw methods in and ai task where it spends 12% of the time.
This is what I am now tweaking and almost all of those 12% will likely go away, but the rest is mostly just vanilla code that needs to be called or is called by vanilla code as part of entity update or aw methods that don't seem to have anything to optimize and are taking up to 5/6% overall anyway,
ice and fire has a bit of stuff to do there, but I don't think that's a conflict and it's pretty low percentage as well. It just seems like you may have a very high number of faction entities on the server.
I will leave this open and close it when the optimizations for those 12% are released.