Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to TerraFirmaCraft Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Dries007

      ATTENTION Forum Database Breach   03/04/2019

      There has been a breach of our database. Please make sure you change your password (use a password manager, like Lastpass).
      If you used this password anywhere else, change that too! The passwords themselves are stored hashed, but may old accounts still had old, insecure (by today's standards) hashes from back when they where created. This means they can be "cracked" more easily. Other leaked information includes: email, IP, account name.
      I'm trying my best to find out more and keep everyone up to date. Discord (http://invite.gg/TerraFirmaCraft) is the best option for up to date news and questions. I'm sorry for this, but the damage has been done. All I can do is try to make sure it doesn't happen again.
    • Claycorp

      This forum is now READ ONLY!   01/20/2020

      As of this post and forever into the future this forum has been put into READ ONLY MODE. There will be no new posts! A replacement is coming SoonTM . If you wish to stay up-to-date on whats going on or post your content. Please use the Discord or Sub-Reddit until the new forums are running.

      Any questions or comments can be directed to Claycorp on either platform.
Sign in to follow this  
Followers 0
Lenaco

Reasons for memory and CPU usage.

11 posts in this topic

I have been wondering what exactly causes TFC to use memory and CPU power.

 

I know that MC can only use one thread so a multithreaded CPU has very limited advantages, better to go with a high speed one.

I know TFC has an increased ceiling, 256 instead of the MC 128 blocks.

I know that chiseling increases the amount of block sides that need to be rendered (theoretically up to 256 times as many sides per block).

I know that entities take up recourses.

 

When exactly is something loaded and unloaded?

How does this exactly work together with teleporting?

 

To what extend does the map size dictates memory usage (disk space is not an issue).

 

I have seen server admins do a lot of things and sometimes I really wonder what they are thinking, do they know something I do not or are they just completely bonkers...

 

I think it would be nice to clearly understand the what and the how, so that (aspiring) server admins can take a little bit of a closer look as to how they are using their recources or how to get as much as possible out of the limited recourses they have available.

 

Thanks in advance!

0

Share this post


Link to post
Share on other sites

well i know that chisel blocks and plank blocks (where you place individual planks) need to have each side rendered as well as sea lvl is twice as high

0

Share this post


Link to post
Share on other sites

I'll try and answer a few of your questions, but likely in parts. First a small correction. Both vanilla and TFC have a world height of 256 blocks. The difference is that in TFC the sea level is ~80 blocks higher. That is on average ~1280 more blocks to render per chunk. At the default render distance that is 500 000 more blocks to render. (Very rough in head math pre-coffee). MC is crap at rendering stuff pre-1.8. That is partly why TFC is heavy generating new chunks. Which is good reason to limit map size/pre-gen map.

Kitty will have to likely have to correct me on this, but I also believe that the number of chunk updates is higher for TFC. In vanilla when a chunk unloads the state of things in that chunk are saved and then it resumes from that state when the chunk reloads. TFC does the same, however when a chunk loads all the Tile entities like trees, crops, farmland etc. reference the world clock to determine their current state. That is why crops grow, kilns burn, barrels process, etc. when unloaded. Again Kitty will have to correct me on that.

Now I eluded to render distance. This is the area around you that you can see, it is also generally the chunks you load. In SMP the render is set serverside and that determines the number of chunks a player loads around them. A player can set render clientside to a different value, but they will always load the number of chunks set by server.

Now map size generally is just disk space, but in SMP it has a huge effect on server load. A big part of server load is number of loaded chunks, this is simplistic view but they do correlate. The reason is overlapping of loaded chunks. Let's say a player loads 400 chunks each. If there are 10 players on a big map they could spread out such that very few of their loaded chunks are overlapping. On a smaller map they would be forced to be closer and so have a higher chance of overlapping.

That is a start of an answer.

What "strange" "bonkers" things are you seeing server admins do?

0

Share this post


Link to post
Share on other sites

Are chunks being unloaded the moment a player is out of render distance of said chunk?

Or do they stay active for a time?

0

Share this post


Link to post
Share on other sites

In general you can assume they unload when they are outside all players chunkloading area. Forge I believe has code to help clean up chunks that should unload, but I don't know details of it.

It isn't really that simple and there are a number of reasons that a chunk may not unload, especially in modded (non-TFC) minecraft. There are also different states of unloaded, ie redstone, pistons and a number of other things can force a chunk to stay partly loaded. These are vanilla mechanisms/bugs and I don't know of any unique to TFC. In vanilla if you run a redstone line a hugely long distance that goes into unloaded chunks those unloaded chunks will load to allow the signal to pass. You can demonstrate the partial load easily. Load a dispenser with TNT and run a line long enough that the dispenser is in unloaded chunks. Pulse the line a number of times. The signal will transmit and the dispenser will eject primed TNTs, but it will just sit there. The moment the chunk loads the timer will start and the TNT will blow up.

0

Share this post


Link to post
Share on other sites

The 9x9 spawn chunks are always fully loaded. This usually isn't an issue, but if you have a lot of complex machinery tunning in those chunks it can have a noticable effect on the whole server. Also, if you load a 5x5 area of chunks using redstone, the center chunk can also process entities (Meaning the tnt would explode even if you're not in the area).

 

A lot of these chunk loading mechanics can be seen in action in Etho's Enderporter video, in which you can see the effect loading and unloading chunks has on things like active enderpearls (which are entities). He lists the conditions to load a chunk at about 18:11 (the 5x5 chunk trick is missing, but he covers that in the next video).

0

Share this post


Link to post
Share on other sites

The amount of loaded chunks and chunks being loaded/un-loaded is rarely an issue nowadays, unless you use a regular Forge server. Bukkit/Spigot and Cauldron perform these actions multi-threaded which gives a huge performance boost. However the main game logic is still single-threaded. With a mod like TFC there is a lot of stuff going on all the time in the way of tile entity updates. On our server the biggest load is generated by tile entities followed by mobs.

 

Tile entity updates are required for things like:

  • tiled soil
  • growing plants (on tiled soil)
  • fruit trees
  • chests
  • barrels
  • TFC 'machines'
  • etc.

Minecraft tries to update all of those things 20 times per second. Like Bunsan explained, if you have 10 people close together, let's say inside 1 town, and they share their resources then there isn't a whole lot the server has to update usually. Just the one town. However if those 10 players each have a town spread out across the map then the server has to update 10 farms, 10 sets of barrels, 10 sets of anvils, 10 sets of farm animals, etc. Suddenly the server load has increased significantly.

 

The thing about mobs is that you don't want to put them in a space where they bump into the walls or each other a lot. You can put 10 pigs in a 16x16 block pen and it'll be fine. Put those 10 pigs in a 2x2 pen and suddenly you're creating a huge load on the server. On our server we have occasionally had people mass breeding chickens inside of small pens. There would be dozens of chickens inside of a small space taking up a large chunk of the server's capacity. Keep in mind that one bad mob farm won't kill a server. But if you have half a dozen of such farms you will notice the effect on a populated server. This is why we limit the amount of tiled soil, fruit trees, anvils and adult farm animals players can have inside of each town. We'd prefer not to impose such limitations, but if we don't then the server would come to a grinding halt because it needs to update all that stuff and it's a lot of stuff to update :)

1

Share this post


Link to post
Share on other sites

Thx!

 

J, you mention somewhere that there is a maximum number of tile entities before it times out a server (forgot where I saw you write that). Do you have a number you can put on that?

0

Share this post


Link to post
Share on other sites

Will depend on the server specs, JVM arguments, etc.

0

Share this post


Link to post
Share on other sites

That's true. On our server we seem to have hit the limit at around 15.000 tile entities. When you get this many tile entities loaded all at once strange things start to happen. In our case players would get disconnected. The server would then be able to unload a bunch of tile entities and continue without crashing. So while the server didn't technically crash, it does prevent players from continuing normally.

1

Share this post


Link to post
Share on other sites

To clarify a bit of things, nothing is actually unloaded immediately in Java. An object only gets marked as being able to be destroyed, but the actual detroy happens when specific JVM process executes, and even then you don't get a guarantee on which iteration exactly the memory gets freed up, since you can't even force that process to be executed, nor can you force it to free a specific amount of memory, more often than not it actually doesn't destroy all marked objects either.

0

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0