TickListGrowth

Discussion in 'Bukkit Preview' started by Mike Primm, Jan 18, 2012.

  1. Offline

    Mike Primm

    This fix is the result of some investigation into reports of explosions in server memory use, leading to crashes and the like.

    The problem, inherited from the vanilla server code, is based on the behavior of the "Tick List" - a delayed processing element associated with handling potential block transformations (leaves fading, grass growing, and so forth). Contributions to the queue come from a variety of sources (a number of block placement handlers and the like), but the bulk of the activity is driven by periodic activity driven for each loaded chunk (checking for grass growing, fire spreading, ice forming, and the like). Unfortunately, while the rate of events arriving is approximately proportional to the number of loaded chunks, the code caps the rate of processing at an (arbitrary) limit of 1000/tick. Certain conditions, such as rapid chunk generation and weather, can drive the event queuing rate even higher.

    In any case, without adding activity generated by plugins, this suggested a basic queuing theory issue : at some point (some number of actively loaded chunks and/or number of players), the average arrival rate would exceed the hard coded limit of 1000 events/tick for processing. Once that happens, the server would be in a death spiral, since the current logic has no consideration towards the size of the queue.

    The fix provides a simple way to smoothly scale up the processing rate, based on the goal that the tick list should not significantly delay processing beyond 1 second (for events that nominally should be processed in 1 tick). To do this, the number of events processed per tick is limited to 1000 (as before) OR 1/20th of the total queue length, whichever is larger. This will tend to lead to a smooth increase in processing load - still avoiding the sharp spikes that the tick list is intended to deal with, but also avoiding the possibility of unbounded growth (since 5% of the list will be consumed every tick - allowing any per-tick arrival rate to be handled with a queue size limited to approximately 20x that rate).
     
    DrAgonmoray likes this.

Share This Page