Massive lag when cables unload
devryb opened this issue ยท 38 comments
When cables unload from a chunk after a player leaves it there is a huge lag spike on the server.
http://puu.sh/kLKpK/2d8404e8c2.png
Also I believe that is what's causing this log spam as well
[20:17:08] [Server thread/INFO]: Unloaded
[20:17:08] [Server thread/INFO]: Unloaded
[20:17:08] [Server thread/INFO]: Unloaded
[20:17:08] [Server thread/INFO]: Unloaded
[20:17:08] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:09] [Server thread/INFO]: Unloaded
[20:17:13] [Server thread/INFO]: Unloaded
[20:17:13] [Server thread/INFO]: Unloaded
The Spam is simply because i needed to test stuff...
The other thing is: Every time a Cable gets unloaded (chunkunload/tileUnload) it causes a BlockUpdate on his block and all others (it is nessesary for renderring) but it is interesting how you got that...
But worldUnload should not call chunkUnloads thats a little bit weird...
Edit: reason beeing because a lot of chunks get unloaded at once and thats why cables need to reload their data... What i can do is make that happen in the tick and process then over time more stuff...
(Less lag)
Just a question how many cables/machines that work IC2 Energy do you have?
Lots... this is on a server with 40 people on at peak and IC2 classic is the main machines mod.
I will try to make another way to unload/load the cables faster...^^" not sure how yet.
We can't give everyone access to something that keeps their base loaded all the time but the ones that load the area only while the player is on is what we've been telling them to use in the meantime.
Yeah...
Just a question can i give you a test Version that logs a Special information for me when a player logs in or after special time (every 10 minutes)? Because i want to know a couple information about your IC2 Energy Kind Tiles. (How much you are using, how much get unloaded and stuff)
Em version wise (i do not update versions so as long the items match you could use any IC2 Classic version) it should work... ^^" But that will take a day.
Its not really testing. Its info gathering. I need simply the info how many Energy Tiles you have placed.
How many got unloaded and loaded when a player leaves and joins so that i can get a proper idea how i need to space stuff out^^^
(Simply limiting the loading and unloading to (example) 100 Blocks per tick. If that is more then it puts everything on a delay list and every tick it removes 100 (if there is enough to process)) So that the server does not lag and removes everything)
Can you see with your program how many many entries the fields in this class have:
ic2.core.energy.EnergyNetLocal
And these fields:
energySourceToEnergyPathMap
registeredTiles
sources
?
There should be no need to update the block for rendering when they are not getting rendered?
Well @modmuss50. How do you make it then if you do not have ticking cables.
IC2 Classic wires need BlockUpdates to check if the are other (valid) cables/machines/generators nearby. That is only a BlockUpdate after that data is gathered (and if it is not the same he has already stored) then he sends a packet (IC2 Packet) to the client which update only that field and that field requests a Renderring update because it is renderring data... So it is nessesary to update new connected blocks in the energy net^^
This not be useful, but this is what I do in TechReborn fmp cables, https://github.com/TechReborn/TechReborn/blob/master/src/main/java/techreborn/partSystem/parts/CablePart.java
Well with that you add Ticking tileEntities to the world which causes more lag then simply a blockUpdate over time. (Even if it is small lag but the more cables you have placed the more general lag you cause)
The problem which the Enet causes is that it calculates to much in to less time. I need to split the work. or thread it... I suggest you remove the ticking part of it.
I believe the ticking part I have is useless now, it was a quick fix for an issue I had relating to multiparts
You can contact me on https://twitter.com/DeVcoFTB if you want me to test any builds for you.
@devryb sorry if i say that. But you need to wait a little bit longer. This kind of project is huge. I would take weeks to finish it. (I know how to solve it but i need to rewirte the whole enet for it) which i can not do atm. So please can you wait a little bit.
Here is a trick to make less lag: Do not have so many Cables next to each other. Every connection/possible wire connection takes time. So if you have like 200 Wires connected to each other then throw something between them (transformer or something) and that will reduce the lag. a little bit. (because each wire has to do less calculation)
@devryb i made a huge improvement on the Enet. During worldload there should be no longer a lag situation... (at least no longer that big) but there will be maybe a couple lag spikes because i could not get the main problem solved (but everything around it is gone) =3 will be there with the next update.
I can not say if the main problem will be removed too but at least server lags on Worldload will be just extreme short thing.
@devryb do you know if that thing also happend on worldLoad?
Because i ran into a problem when you load stuff (getting weird with that fix) but onloading is save and incredible fast xD ^^" If you can help me with that info it would help a lot.
From what I've seen the biggest issues are when players login and logout. I haven't seen world load being really slow yet.
oh well... @devryb thats hard. I can not say for sure that i can fix the problem with player logs in because i have to write a special system for it but i can say at least that the current system should be handling on logout/chunkunload the stuff quite fast... (Testing atm with much wires)
also just a note: Detector Wires or mods that check how much EU has been flowing to wires should be now really much faster (on long wires) too.
But i see one major problem... The current system is builded with not much paths (it had simply 1 energy path for testing and much wires between them) the question is that i do not know how it will work if much paths are builded. It could be possible (if my methode is slower) that it will even decrease the speed and make it worse... But i am thinking that it should not come to this case.
@devryb it is maybe fixed. When i push the update and you have some test results could you inform me on that?
@devryb update is now out. Took a little bit longer. But that should decrease your lag when players log in and out to almost 0. I hope it at least
I have to say that this improvement is a concept that need to be tested with servers. I can not say if the lagspikes will be completely gone. But they "should" be drasticly decreased from what my test have shown me...