BluSunrize / ImmersiveEngineering

Wires, transformers, high voltage! Bzzzzt!
Other
780 stars 389 forks source link

[1.12.2] Request for Performance review of the TileEntityConnectorMV #2845

Closed ProsperCraft closed 6 years ago

ProsperCraft commented 6 years ago

Description of the issue:

We are seeing a sizable decrease in server performance due to the MV Connectors and I would if you could check to see if they could be tuned for performance.

Lagoggles report- 2018-03-04_20 45 11

Tickprofiler showing them taking 9% of the server ticks. 2018-03-04_20 51 56

Screenshot of server tps 2018-03-04_20 54 50

Sampler nps file to view in VisualVM mvconnector.zip

Server stats - 2018-03-04_20 58 27

Server specs - AMD RYZEN Threadripper 1950X 16-Core / 32 Threads 3.4 GHz Socket sTR4 YD195XA8AEWOF G.SKILL TridentZ RGB Series 32GB (2 x 16GB) 288-Pin DDR4 SDRAM DDR4 3466 (PC4 27700) Desktop Memory Model F4-3466C16D-32GTZR MSI X399 GAMING PRO CARBON AC sTR4 AMD X399 SATA 6Gb/s USB 3.1 ATX AMD Motherboard SAMSUNG 960 PRO M.2 512GB NVMe PCI-Express 3.0 x4 Internal Solid State Drive (SSD) MZ-V6P512BW Seasonic Flagship PRIME TITANIUM 750 SSR-750TD Active PFC 80 PLUS Titanium 750W ATX 12V 135mm Fluid Dynamic Bearing Fan Super Quiet Power Supply Corsair Hydro Series H80i V2 Water / Liquid CPU Cooler. 120mm CW-9060024-WW ARCTIC MX-4 Thermal Paste, Carbon Based High Performance Thermal Compound for All Coolers, Thermal Interface Material, 4 Grams

Versions & Modlist

ImmersiveEngineering-0.12-78 forge-1.12.2-14.23.2.2623-universal

Modlist-

https://gist.github.com/ProsperCraft/ff4c8e186583aff333ba9acce7f23b6a

malte0811 commented 6 years ago

I'd look into thermal dynamics and millenaire first. Their tick handlers are taking up 19.5 and 14.5 percent of the server tick time (bottom right area of lag goggles). The connectors can be optimized a bit though, I might get around to doing that later today.

malte0811 commented 6 years ago

Actually this one is different from the performance issues I knew about. It seems like the cached outputs are getting reset all the time. I'm pretty sure it isn't just the cache being stupid since the cache is a bog-standard HashMap and the keys are just BlockPos's. Is there anything like

on your server? I think I can do something about this lag as well, it's be a good idea in general as well as in this specific situation. EDIT: I think I found what's wrong, I inverted the caching if statement by accident.

ProsperCraft commented 6 years ago

I asked the players on the server, and nobody has anything like that.

Unless of course....I have an ic2 chunkloader at my base and it was running out of power, I did see it flicking off and on, that may be the chunks being loaded and unloaded now that I think of it.

I plan to remove all mod chunkloaders and go to a chunkloader sponge plugin to eliminate this problem, which only works when the player is on and doesn't flicker off and on.

This brings up a good point, perhaps I should contact IC2 and have them check to make sure it isn't possible of this behavior, and that it will require a buffer to be full to start chunkloading or something to stop it from off and on instantly if that is what it is doing.

malte0811 commented 6 years ago

Not IC2's fault, see my edit. This is a stupid mistake I made, I'm putting the connections in the wrong cache. And check whether they are in the right cache before recalculating them.

ProsperCraft commented 6 years ago

That is so fantastic! Thank you for taking the time to look into them.

CplPibald commented 6 years ago

@malte0811 Does this bug fix also impact thermoelectric generators?

I ran the same test with LagGoggles, which is reporting TileEntityThermoelectricGen using around 400 microseconds per tick for each generator. On my RF network (much smaller than above), TileEntityConnectorLV second with about a tenth of that.

malte0811 commented 6 years ago

It will impact anything while it's outputting RF to a connector.

CplPibald commented 6 years ago

Excellent. I look forward to the updated version. Thanks for your hard work.

CplPibald commented 6 years ago

@malte0811 Did the fix for this issue make it into the newest build? Using 0.12-79 I'm still seeing immense CPU usage in LagGoggles for thermoelectrics and for connectors on my server.

The first image is from the live server with an existing energy network. The player had removed the thermoelectric generators at my request, but the HV connectors are still causing very high tick times.

thermoelectric-lag2 The latter two images are from a SP world I created to test. thermoelectric-lag 2018-03-21_13 37 27

If you'd prefer, I can open a new issue for this.

malte0811 commented 6 years ago

The fix should be in IE 79. LagGoggles data may be helpful for players/server owners, but it is completely useless for me/us. It just tells us that there is lag "somewhere in this pretty complex piece of code with about 5 different ways of causing lag". Post a VisualVM/sampler nps file, otherwise I won't be able to help with this.

ProsperCraft commented 6 years ago

Here is a good page on how to use sampler.

https://refinedstorage.raoulvdberge.com/wiki/profiling

CplPibald commented 6 years ago

@ProsperCraft Thanks for the link. I'll try that on my server and see if I can get numbers.

However, the repro case is fairly simple if somebody more familiar with the tools visualvm/sampler can do this quickly. I duplicated the setup above on a new map in a clean modpack containing vanilla + IE 79. LagGoggles shows me very high update times in the hundreds of μs/t for thermoelectric generators, and dozens of μs/t for connectors, even though the network is as simple as possible.

ProsperCraft commented 6 years ago

@CplPibald You should also learn warmroast, as a server owner you need it.

It can profile the server from outside the server, so you can see what causes it to lock up. It is very helpful to mod authors.