mojira.dev
MC-144427

Bad performance of targetSelector of agressive mob AI

The bug

On my server, I must set doMobSpawning to false because AI of aggressive mob take all resources!
If I add datapack to remove AI on zombie, that's skeleton AI which take all resources.
And if I add datapack to remove AI on skeleton too, that's creeper AI which take all resources, etc.

[06] |   |   |   |   |   |   tick - 99.34%/91.47%
[07] |   |   |   |   |   |   |   minecraft:zombie - 89.92%/82.25%
[08] |   |   |   |   |   |   |   |   ai - 98.83%/81.29%
[09] |   |   |   |   |   |   |   |   |   newAi - 99.97%/81.27%
[10] |   |   |   |   |   |   |   |   |   |   targetSelector - 98.83%/80.32%
[11] |   |   |   |   |   |   |   |   |   |   |   goalSetup - 99.96%/80.29%
[12] |   |   |   |   |   |   |   |   |   |   |   |   canSee - 99.81%/80.14%
[12] |   |   |   |   |   |   |   |   |   |   |   |   unspecified - 0.19%/0.15%
[11] |   |   |   |   |   |   |   |   |   |   |   unspecified - 0.04%/0.03%
[11] |   |   |   |   |   |   |   |   |   |   |   goalTick - 0.00%/0.00%
...

With two players that's ok. But with four that start to lag, and with 10 players, the server crashes because tick too long with max-tick-time to 60 secondes (max-tick-time=60000).

Linked issues

Comments 2

Can you please check if that still applies to recent releases. 1.14.4 or 1.15-pre1?

Matthias Lukaszek

I can confirm this bug on my server with version 1.15.2

 

---- Minecraft Profiler Results ----
// Am I not running fast enough? :(Version: 1.15.2
Time span: 9435 ms
Tick span: 43 ticks
// This is approximately 4.56 ticks per second. It should be 20 ticks per second--- BEGIN PROFILE DUMP ---[00] tick(42/1) - 96.71%/96.71%
[01] |   levels(43/1) - 99.56%/98.38%
[02] |   |   world minecraft:overworld(43/1) - 90.34%/88.88%
[03] |   |   |   tick(43/1) - 99.88%/88.77%
[04] |   |   |   |   entities(43/1) - 94.11%/83.55%
[05] |   |   |   |   |   regular(43/1) - 99.40%/83.04%
[06] |   |   |   |   |   |   tick(49969/1162) - 97.55%/81.00%
[07] |   |   |   |   |   |   |   #getChunkCacheMiss 15416/358
[07] |   |   |   |   |   |   |   #getChunk 22761/529
[07] |   |   |   |   |   |   |   minecraft:pillager(645/15) - 55.68%/45.10%
[08] |   |   |   |   |   |   |   |   #tickNonPassenger 645/15
[08] |   |   |   |   |   |   |   |   ai(645/15) - 98.09%/44.24%
[09] |   |   |   |   |   |   |   |   |   newAi(645/15) - 99.98%/44.23%
[10] |   |   |   |   |   |   |   |   |   |   goalSelector(645/15) - 99.23%/43.89%
[11] |   |   |   |   |   |   |   |   |   |   |   goalTick(645/15) - 99.31%/43.59%
[12] |   |   |   |   |   |   |   |   |   |   |   |   #getChunkCacheMiss 5/0
[12] |   |   |   |   |   |   |   |   |   |   |   |   #getChunk 430/10
[12] |   |   |   |   |   |   |   |   |   |   |   |   pathfind(215/5) - 99.80%/43.50%
[13] |   |   |   |   |   |   |   |   |   |   |   |   |   #getChunkNow 7267/169
[12] |   |   |   |   |   |   |   |   |   |   |   |   unspecified(645/15) - 0.14%/0.06%
[12] |   |   |   |   |   |   |   |   |   |   |   |   canSee(190/4) - 0.06%/0.03%
[13] |   |   |   |   |   |   |   |   |   |   |   |   |   #getChunkCacheMiss 36/0
[13] |   |   |   |   |   |   |   |   |   |   |   |   |   #getChunk 1140/26
[11] |   |   |   |   |   |   |   |   |   |   |   goalUpdate(645/15) - 0.38%/0.17%
[12] |   |   |   |   |   |   |   |   |   |   |   |   #getChunkCacheMiss 4/0
[12] |   |   |   |   |   |   |   |   |   |   |   |   #getChunk 36/0
[12] |   |   |   |   |   |   |   |   |   |   |   |   #getChunkNow 9/0
[12] |   |   |   |   |   |   |   |   |   |   |   |   #getLoadedEntities 1/0
[12] |   |   |   |   |   |   |   |   |   |   |   |   unspecified(645/15) - 80.03%/0.13%
[12] |   |   |   |   |   |   |   |   |   |   |   |   canSee(201/5) - 19.97%/0.03%
[13] |   |   |   |   |   |   |   |   |   |   |   |   |   #getChunkCacheMiss 37/0
[13] |   |   |   |   |   |   |   |   |   |   |   |   |   #getChunk 2874/66
[11] |   |   |   |   |   |   |   |   |   |   |   unspecified(645/15) - 0.23%/0.10%
[11] |   |   |   |   |   |   |   |   |   |   |   goalCleanup(645/15) - 0.08%/0.03%

 

Linux 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

model name      : Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz

Desjardins Jérôme

(Unassigned)

Community Consensus

Platform

Important

Performance

Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a, 1.16.2, 21w08b, 21w19a

Retrieved