Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-591

Activation range higher than defaults causes immense lag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None

      The empirical description of the bug is in the summary. Below is what we found in code and questions / suggestions where it could stem from.

      We found that while Spigot 1.7 was running fine with

      entity-activation-range:
            animals: 128
            monsters: 64
            misc: 64

      Spigot 1.8 caused immense lag. Lag is captured on the WarmRoast screen cap in attached files.

      We changed those settings to recommended ones by Spigot defaults.

      entity-activation-range:
            animals: 32
            monsters: 32
            misc: 16

      If you look at our WarmRoast screen, thing that creates the HashSets (bottom of the tree) is this method in Google's multimap: https://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/collect/AbstractMapBasedMultimap.java#303

      We think that code does the following: if no collection for that key is found, create a new collection, put the key there and return that collection.

      We found that Spigot is calling that method and it is all connected somehow to activation range of entities. Here what is going inside:

      1. Every tick, for every world, this method is called ActivationRange.activateEntities(World world);
      2. For every player in that world, get all the chunks around him, and run second method ActivationRange.activateChunkEntities(Chunk chunk)
      3. Nothing worrying really happens here, other than getting the iterator of chunk.entitySlices (from the warmroast tree we see that there lies the problem)
      4. Now, moving to MCP decompiled code (we tried to find this in Spigot classes, we might be blind, sorry if that’s the case!), see the second attached screenshot.
      5. For some reason, the collection (on which we call get) does not have the required key, thus requiring the creation of new collection.

      This is all that we could piece together. I hope it’s not a total waste of your time – we do know that lowering those values resolves the issue but we’re still wondering why the change is so dramatic insofar requiring nerfing activation to 1-2 chunks.

      Best regards!

      PS: We’ll gladly provide more info, please ask us anything you think could help here.

        1. warmroast.png
          warmroast.png
          281 kB
        2. mcp-get.png
          mcp-get.png
          27 kB

            Thinkofdeath Thinkofname
            ridddle Piotr Petrus
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: