TPS lag caused by sleeping rodents
Steanky opened this issue ยท 6 comments
I've seen some similar issues but I'm going to try and provide as much detail as possible to help fix the problem. Also, to preempt certain questions, here's some additional information about my setup and modded environment:
System
OS: Windows 10 version 10.0.18362 Build 18362
CPU: i5-7600K @ 3.6GHz, OCed to ~4GHZ. 4 core.
GPU: RTX 2060, GPU clock OCed to 2070MHz and memory clock to 7500MHz
Memory: 16G DDR4
Java
Java version: 1.8.0_211
Attached profiler: JProfiler, using sampling
MC arguments: -Xmx6G -Xms256m -XX:PermSize=256m
Modded environment
Forge version: 14.23.5.2854
Potentially relevant mods: FoamFix, VanillaFix, LagGoggles, TickProfiler, Biomes O' Plenty, ClimateControl/Geographicraft, Realistic Terrain Generation
Note that Animania is running as part of a custom modpack containing 170+ mods, so this is only a partial list.
Expected Behavior
TPS remains at or near 20 when any Animania entity is loaded and the total entity count is low.
Actual Behavior
2-5 TPS on average when certain Animania entities are loaded, even at a low total entity count.
Steps to Reproduce
- Launch Minecraft Forge version 14.23.5.2854 with Animania 1.7.3, Biomes O' Plenty, ClimateControl/Geographicraft, FoamFix, Realistic Terrain Generation, and TickProfiler.
- Create a creative world using the seed 149450001270357515 and world type RTG - Realistic
- Teleport to (87, 86, 465) (which should be a Coniferous Forest)
- Spawn a bunch of rabbits (a roughly even mix of adult males and females)
- Set the time to night.
- Wait a bit. If you use a profiler, you should notice the server thread spends a disproportionate amount of time on running the rabbit AI, specifically, sleeping.
Version of Minecraft, version of Animania, Single Player or Server
Animania 1.7.3 for MC 1.12.2, Singleplayer
Screenshots encouraged
@Tschipp Could we have an estimate of when the new release is released? I'm a little confused why there are changes on Github from 2 months ago but nothing has been updated on CurseForge for 1 year. Spent ~15-30 minutes looking for this "test build" people mention and I've had no luck unless they're just referring to the latest build on CurseForge. And the Discord server invite doesn't work.
Thanks!
@pinkpig3777 I don't give estimates anymore, sorry. You can get the tester role if you ping me on the discord. This is the discord invite: https://discord.gg/7ne2Dqp
Thanks for the detail @John-DND ... we've known for a while that 'Sleep' can cause TPS lag, especially on servers, but haven't been able to identify the cause. The entity AI should only be checking periodically (as in every 30 seconds) if the animal needs to be awake or remain asleep. This detail will help us create some test scenarios.
For the time being, I might recommend you turn off Sleep in the config to reduce lag.
Thanks, PC.
Looks like I skipped the sleep AI for Rabbits, Hedgehogs and Hamsters when I did the rewrite of the AI. Even though I didn't have any issues with the current version when testing with 200+ rabbits in a small area, I will change their AI to the new, optimized system