AppliedEnergistics / Applied-Energistics-2

A Minecraft Mod about Matter, Energy and using them to conquer the world..
https://appliedenergistics.github.io/
Other
1.44k stars 661 forks source link

40% ae2 usage crazy bad performance #7884

Closed funnycubeguy closed 3 months ago

funnycubeguy commented 5 months ago

How to reproduce the performance issue

I have a world with 4 of the same bases. If I remove the gregtech layer of these bases ae2 drops down to around 3%.

There are no addons just ae2 from the all the mods 9 pack. I have configured my ae2 config to raise ticks of everything with no luck. There seems to be a bug somewhere. I can reproduce on multiple servers with bases similar to this one

Here is the current config: https://pastes.dev/hp49gcOnCH

Same performance with default config

Spark profile link

https://spark.lucko.me/hw0W9EgrHO

Which minecraft version are you using?

1.20

On which mod loaders does it happen?

Forge

Additional details

No response

Mari023 commented 5 months ago

if I am reading that correctly, 39% of tick time is spend on ae2 iterating over every devices that can tick, without even doing any work (your tick rate settings might are basically equivalent to never tick). (the other 2% ae2 is taking seems somewhat normal)

do you know roughly how many devices you have in the networks?

shartte commented 5 months ago

@funnycubeguy Please run /give @s ae2:debug_card and shift+click while holding it in hand

Please report the results, which should look a bit like this: image

funnycubeguy commented 5 months ago

@funnycubeguy Please run /give @s ae2:debug_card and shift+click while holding it in hand

Please report the results, which should look a bit like this: image

thanks I have since then removed the 3 copies of the base to avoid any conflicts with p2p or other things. so this is just the 1 base on a fresh server with addons enabled default atm9 pack install.

I can remove all addons if you want. i have used the same config above with all ticks set to

image

Here is a spark profile with just the single base: https://spark.lucko.me/JQNlHRyRqx it will eventually reach 15% over time the longer it runs.

the actual server has a few bases like this which causes ae2 to reach 22 - 40% usage, but this base I can repeat the issue easily and 10% is crazy for just 1 base.

image

thanks for the help. i have this on a test server if anyone wants to see the base

funnycubeguy commented 5 months ago

I want to add I've removed the top 2 out of 4 layers of gregtech on this base. This is the spark profile: https://spark.lucko.me/QMz7gfJhk1

Then removing the last 2 layers of gregtech on this base: https://spark.lucko.me/GhmCSMmMOD

It'll slowly go up and down around 3% usage at this point.

There is 1 final layer of machines (mostly mek) when that is removed we hit 2% ae2 usage. :https://spark.lucko.me/00fkynXdyf

There are many layers below but it is ae2 crafters, the p2p main network, assemblers, drives ect other things below removing those doesn't do much.

If you want me to copy the base again to 4 bases I can do so, but it's the same result as this just multiplied by 4.

funnycubeguy commented 5 months ago

I thought it would be interesting to restore the base back to default and remove all pattern providers connecting to the machines, but it seemed to do nothing even though everything looks broken

https://spark.lucko.me/BAunGTswUr 13% usage

Removing the cables connecting to storage buses / exporters/importers also does nothing? At this point the network looks pretty busted

funnycubeguy commented 5 months ago

Removing all ae2:cable_bus from the gregtech layers seems to work: https://spark.lucko.me/jGHwBgwCXA

(cable + all buses).

shartte commented 5 months ago

You'll have to provide a world-save download for the case where it is the worst and provide a link to the modpack, otherwise this is impossible to debug.

funnycubeguy commented 5 months ago

You'll have to provide a world-save download for the case where it is the worst and provide a link to the modpack, otherwise this is impossible to debug.

Modpack link: https://www.curseforge.com/minecraft/modpacks/all-the-mods-9

I have a schematic of the base and a world download. The pack already includes spark. There is a white elevator in the bottom left corner which will take you down to the ae2 setup. ok.zip

shartte commented 5 months ago

@funnycubeguy Can you please try to repro your original problem (with the super high tick times) using this experimental version?

https://github.com/AppliedEnergistics/Applied-Energistics-2/actions/runs/9294092791/artifacts/1550381558

(This reduced per-tick-% for AE2 from 10%->~3% using your test world)

funnycubeguy commented 5 months ago

@funnycubeguy Can you please try to repro your original problem (with the super high tick times) using this experimental version?

https://github.com/AppliedEnergistics/Applied-Energistics-2/actions/runs/9294092791/artifacts/1550381558

(This reduced per-tick-% for AE2 from 10%->~3% using your test world)

Thank you so much I have been watching the dev channel. I will test this out and report back

shartte commented 5 months ago

@funnycubeguy You should let me know who you are on Discord, sending the jar on discord is easier :-P

funnycubeguy commented 5 months ago

@funnycubeguy You should let me know who you are on Discord, sending the jar on discord is easier :-P

Discord: netmail

funnycubeguy commented 5 months ago

After a lot of testing this worked amazing! With just the single base I provided you guys it brought the usage from 10% down to 1.5%.

I then copied the base 4 more times with an extra base that was already in the world netting around a 13% - 20% overall.

Heres a few spark profiles with the 5 bases.

https://spark.lucko.me/OMek9JJqYS https://spark.lucko.me/cHjI6vi3wT https://spark.lucko.me/xk30Bp7mCf

I am overall super happy with the results thanks so much

I should note I saw as much as 56% usage before this patch with 4 of these bases.

shartte commented 5 months ago

After a lot of testing this worked amazing! With just the single base I provided you guys it brought the usage from 10% down to 1.5%.

I then copied the base 4 more times with an extra base that was already in the world netting around a 13% - 20% overall.

Heres a few spark profiles with the 5 bases.

https://spark.lucko.me/OMek9JJqYS https://spark.lucko.me/cHjI6vi3wT https://spark.lucko.me/xk30Bp7mCf

I am overall super happy with the results thanks so much

I should note I saw as much as 56% usage before this patch with 4 of these bases.

Thank you! Can you tell me how you do these base copies? I'd like to have that world with 5 bases :)

funnycubeguy commented 5 months ago

After a lot of testing this worked amazing! With just the single base I provided you guys it brought the usage from 10% down to 1.5%. I then copied the base 4 more times with an extra base that was already in the world netting around a 13% - 20% overall. Heres a few spark profiles with the 5 bases. https://spark.lucko.me/OMek9JJqYS https://spark.lucko.me/cHjI6vi3wT https://spark.lucko.me/xk30Bp7mCf I am overall super happy with the results thanks so much I should note I saw as much as 56% usage before this patch with 4 of these bases.

Thank you! Can you tell me how you do these base copies? I'd like to have that world with 5 bases :)

I use the world edit mod. It looks like there is 6 but that's due to the build being too large to copy.

Here is the world it was too large to upload on git: https://filebin.net/pro3zmqb3dh6tq7m

shartte commented 5 months ago

@funnycubeguy Would it be okay for you if I closed this issue for now, or is it still unplayable for you with the latest changes? I'll keep working on optimizations based on your use-case, but probably on the 1.21 branch 🤔

funnycubeguy commented 5 months ago

@funnycubeguy Would it be okay for you if I closed this issue for now, or is it still unplayable for you with the latest changes? I'll keep working on optimizations based on your use-case, but probably on the 1.21 branch 🤔

Thanks I have tested it on live servers and out of the 5 I have this is the highest usage. Still a little high: https://spark.lucko.me/r82APbBHfQ but might be from some players.

Otherwise I just want to let you know about 2 more issues which would be really great if fixed for 1.20.1.

https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/7671 https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/7872

The first with the crafting cpu is annoying because is destroys servers when players start to break their co-processors.

I know you guys want to stick to the latest versions, but atm9 skies has just launched on 1.20.1 and atm9 will be going strong for the next year :) Thanks for everything

shartte commented 5 months ago

Yeah #7872 is a potential fix for #7671, but requires an almost full redesign of the grid system. So much has changed between 1.20.1 and 1.20.6 that it means we'd have to do it twice, so that is highly unlikely.

I can take another look at #7671 however, since that should already have been helped by the fixes for this issue.

(oh and p.s.: 1.21 is coming out in a week or so :-P)

funnycubeguy commented 5 months ago

Yeah #7872 is a potential fix for #7671, but requires an almost full redesign of the grid system. So much has changed between 1.20.1 and 1.20.6 that it means we'd have to do it twice, so that is highly unlikely.

I can take another look at #7671 however, since that should already have been helped by the fixes for this issue.

(oh and p.s.: 1.21 is coming out in a week or so :-P)

Thanks for everything, can't wait for 1.21 although the all the mods dev team just released atm9 skies on 1.20.1 so 1.20.1 will be very popular for another 2 years. You can close this now