Major lag caused by Tier 3 crafters
SubtypeZero opened this issue ยท 18 comments
One of the players on my server placed down about 20 of the T3 crafters and they seem to be taking roughly 10% of the server tick when most of them are not even running. Since the crafters seem to mostly run on the shared code that handles all of the actual crafting and updating, this is possibly an issue with all crafters (regardless of tier).
Not sure much can be done about this. The crafters simply are a pretty expensive block and you shouldn't overdo them. It is the same with spamming any other block that has to do a lot of calculations
I haven't looked into it too much, but if it can't be optimized in it's current form, then wouldn't it at least be possible to do some of the calculations in another thread and try to avoid doing everything on the main server thread? Once again, I haven't looked too far into this particular issue, so correct me if I'm wrong. I just don't see how automatic crafting should be taking that much of the server resources. I'm sure it's complicated but I'd like to see if there's any way it can be improved upon with the goal of optimizing for performance.
I had that particular player reduce it down to four T3 crafters and 3/4 of them still show up on my list of top 5 single entities causing lag. Those three CrafterBlockTileEntity3
s were taking about 9.5% of the server tick at the time of the profile (according to the TickProfiler).
Is he enabling 'fast speed' for them? Disabling that might improve matters.
Doing calculations in a thread is not really possible since Minecraft is not multithreaded and the crafter has to access a lot of data. I will however try to profile the crafters to see if there is anything I can do.
Yes, he did have them on 'fast' but I've seen quite a bit of lag from these even with them on 'slow'. I'll certainly change that and see if helps. I appreciate the effort, I'd like to see these working faster since they're pretty much the only decent option for players who are looking to automate crafting on Sky Factory 3 servers.
Are the T3 crafters doing recursive recipes? If so I suggest using the compactor mod. If you're simply making cobblestone, the mod has a creative block that generates lag-free tons of cobblestone. I suggest using that instead of generating your own cobblestone with things like extra utilities transfer nodes. Minetweak a recipe for the creative block or place where it can be shared and protect it from being mined. One block per world is more than enough.
Too bad steve's factory manager or hilburn's advance crafting manager doesn't work with 1.12.x =( Those are much more tps friendly.
I did a profile on a series of T3 crafters at full speed and couldn't find any bottleneck. I think this is just to be expected when you have a lot of something doing something
I definitely see a big difference between leaving them on "fast" vs. leaving them on "slow", but I still don't feel that they should be taking up much of the server resources.
From Forever Stranded Lost Souls:
RFTools 1.12-7.29
McJtyLib 1.12-2.6.4
I've been experiencing issues with the crafters using a large portion of the tick time with multiple 1.12.2 versions though.
To @Mohron , what version?
Since this week our ATM3 (v5.8) server had LagGoggles added and everybody has been streamlining their bases. As everbody (10-20) was using 2-3 T3 ones to process their Mystical Agriculture, guess the result.
Hands down, I really like the crafter and as has been said, it has to access a lot of data.
Inventory handling;
Lets look at the mystical usecase. Typically it sits there, waiting for the ingredients, scanning its inventory, which is scanning every single slot. ( I think minecolonies hit that wall with their warehouse, scanning 20+ chests. They wrote their own inventory handler afterwards.).
But writing an inventory overly to efficiently handle ingredient requests is outside of quick.
A quick option would be to have the possibility to instead of ghosting the slots with something not needed, to outright disable the slots, so there is no longer the need to check them.
Speed option:
Slow mode is faster than nearly every other autocrafter, I think even AE2/RS. Doing up to 8 crafts per tick is nothing I would consider slow. I propose the something like slow=1 recipe/t, normal = tier recipes/t, fast stays.
I'm having trouble reproducing this. Can someone who's having the problem upload a saved game that demonstrates the problem, and only uses the mods RFTools and Lag Goggles?
Never mind, I got it to happen.
I just pushed two commits that will improve performance a lot if your crafters aren't all crafting at 100% capacity all the time.
Solution:
I was having this problem in the latest version on the latest version of ATM3. I found that crafting Mystical Agriculture essence into blocks immediately, and them crafting upwards is the ideal way to reducing more than half the lag caused by crafting. There are 3 key points for this to work:
- Use a tier 3 crafter, and insert the farmed inferium essence.
- Immediately craft the inferium essence into inferium blocks, and then craft up from there in block form only.
- Have a 3 or 4 slots dedicated and remembered for all levels of the blocks, and the inferium essence, up to agradditions purple, and output the last block externally.
If you remove even one of these requirements, lag ms goes up. Fast vs Slow had no mean ms difference. This was tested on both single and a server, both brand new, and both with the same seed.
My mean time went from 2500ms, to 1080ms, with 64 essence being delivered every 30 ticks, faster than an 11x11 tier 6 farms will output. This was determined using lagGoogles.
I still don't see this as a bug. I think however that in a future version I'll remove the 'fast' option (or at least make it configurable so you can disable it). Otherwise the crafters simply do a lot of work that you would have to do using multiple machines otherwise (causing even more lag)