Preventing Server Lag- Part 1: Spotting a Leaky Pipe

, Mon Oct 08 2012, 09:53AM

As our resources and machines have grown we're now reaching the point where some of us (myself included) are running more than one quarry.

This is leading to many more items being dug up and sent through pipes to chests for processing.

The problem with BuildCraft pipes is they're not very smart. You can have a chain of several chests on a single pipe, but if the first one is full, the materials don't re-route to the next available chest. They then start "overflowing", popping the items in a pile on the floor which grows and grows until the server strains, fps drops and everyone experiences lag. We all know how unpleasant that is.

How do you know you have a problem? well, pressing F3 will bring up the stats on the amount of entities (blocks in tubes, dropped on floor etc) in the top left of the screen:

Entitycount

Where it says "E: 45/171" that tells me that there are currently 171 entities within the chunks loaded around me that are either in transit within pipes, or dropped on the ground. The number 45 indicates that i'm currently "seeing" (you might not necessarily see them, but your client is rendering them so they are infront of you nonetheless).

some people experience lag with the red bar meter when viewing this debug info. you can turn off the lag-o-meter by going to options>Other Settings and turning Fast Debug on:

08 111544

Now that you can view the debug info without fps drops or a red cpu graph getting in the way, you can now locate sources of lag.

if the second half of the entity count (171 in my case here) is increasing steadily, you have a problem. When this number starts heading above 500 (1000 for us on very fast pc's) you'll start getting an fps drop. Above 1500 and the server will most definitely lag. look around with your view and look at the left part of the entity count. When that number peaks to a number similar to the second number, you now know where your leak is.

fps and server lag should return to normal once the item entities are picked up, or when they despawn.


By keeping the debug screen up and keeping an eye on the entity figures, we can help each other spot leaks and fix them before they become a problem.

I strongly suggest we all use this debug info as much as possible, if not constantly while online.