CraftBukkit++

Discussion in 'Resources' started by Afforess, Jan 16, 2012.

  1. Offline

    Afforess
    • Spout Team
    • Administrator

    Achievements:
    7
    Ratings Received:
    +858 / 86
    A lot of larger servers have problems with Craftbukkit, specifically with terrible ticks per second, which causes lag in game, and ruins the PVE and PVP experience for players.

    CraftBukkit++ is an optimized build of Craftbukkit, with performance enhancements in mind. These enhancements are all configurable via the bukkit.yml file in your server folder.

    I will attempt to keep CraftBukkit++ up to date with the official repository, but a lag of 24 hours is likely.

    How CraftBukkit++ works:

    Optimized Growth/Decay
    Growth and Decay (Wheat, saplings, leaf decay, etc) are the single biggest tax on servers. For an understanding why, a 15x15 chunk area, with the player at the center is checked for growth each server tick.

    Vanilla growth area:
    [IMG]

    Green squares are chunks checked for growth each tick. That's a lot. And this is per-player.

    Modified growth area:
    [IMG]

    Oh, pretty colors. But what does it mean? The Red chunk (the one the player is standing in) will always experience growth/decay. This means that players won't be surprised by leaves not decaying, etc.

    The green chunks show likely growth areas. Instead of always searching nearby chunks, the server only grows/decays in a specific number of chunks each tick. The amount is in your config. If you have 200+ players, I recommend 1000. If you have less, increase that number. More chunks = more lag, but faster growth. You will need to experiment to find a happy medium.

    Anyway, likely growth areas *may* grow and decay, but are not certain. They will only grow/decay if the server has enough leftover chunks to check.

    HOW MANY CHUNKS SHOULD YOUR SERVER USE?

    Depends on the size. If you are a 50 man server or less, try 2500 chunks. If you are a 100 man server, try 1500 chunks. 200 man, 750. I don't advise going below 500. If you use zero, or less than zero, GROWTH WILL BE DISABLED.

    Optimized ItemStacks:
    Items near each other and of the same type and data will automatically merge into an itemstack, to save on calculations. This can drastically cut down on CPU, because each itemstack floating in the world can use the same time as a zombie or skeleton might. Merging them together will drastically reduce the amount of items on your server, and save memory and CPU.

    XP orbs will also merge, like items do, by combining xp.

    The radius at which items will merge together is in the config. If the radius <= 0, items will not merge.

    Optimized Redstone Torches
    Some changes have been made to how the game internally locates and registers the locations of redstone torches. It does not alter gameplay, and hence no config option is present.

    Disable Random Lighting Checks
    Each tick, the game randomly samples several thousand blocks to verify that the light levels are correctly. This is a huge waste of CPU, since light updates just fine from block placement, and very rarely needs to be correctly. With this disabled, light updates will only happen when new chunks are generated or blocks are placed. This is adjustable in the config.

    Mob Spawn Range
    This changes how far around players mobs will spawn. By default this range is 8 chunks, (or 16*16 blocks, [256 if you're not a math geek]). This is a pretty large area. By default, with CB++, this range has been reduced to 4 chunks around players. Players will still encounter the same mobs in each chunk, they will just be more centered around players.

    Monsters Per Chunk
    This is how many monsters (creepers, skeletons, etc) will spawn in each chunk of the world. The default value is 70 per chunk. Increasing this will increase the monsters spawned, decreasing it will reduce the monsters spawned.

    Land Creatures Per Chunk
    This is how many passive creatures (sheep, pigs, etc) will spawn in each chunk of the world. Acts the same as monsters per chunk. Default is 15.

    Water Creatures Per Chunk
    This is how many water creatures (at the moment, only squids) will spawn in each chunk of the world. Acts the same as the above 2 settings. Default is 5.

    Aggregate Ticks
    With the setting at 4 (the default) the server will skip the chunk-tick process 3 ticks and at the fourth tick it will decide what chunks to tick, select them and then applying growth 4 times. This means the server need to spend less time choosing chunks and more time growing. If you use a setting of 1, the server will not aggregate any ticks and work normally.

    Sugar Cane/Melon/Pumpkin/Wheat/Mushroom/Tree Growth Rates
    These modify how quickly food grows on your server. This settings do not affect performance in any way. They are a percentage of normal growth, so 100% is normal growth rate. 200% is 2x normal growth rate, and 50% is 1/2 normal growth. Experiment with to your liking.

    Filter Unsafe IPs
    Uses http://www.spamhaus.org/xbl/ unsafe ip address service to automatically block any unsafe connections to your server. Any known infected pc or botnet ip address will be blocked from connecting.

    New Commands:
    • /merge - requires 'bukkit.command.merge' permission. Alters the item merge radius.
    • /growth - requires 'bukkit.command.growth' permission. Alters the number of chunks that growth occurs on each tick.
    • /mobspawn - requires 'bukkit.command.mobspawn' permission. Alters the range that mobs will spawn around players.
    Recommended Build
    Development Builds
    Source

    Have ideas for further performance fixes? Let me know.

    This is a personal project, unaffiliated with Spout, only posted here because Bukkit does not allow custom builds on their forums.

    If you appreciate this, donate for my time.[IMG]
    Last edited by Afforess, Apr 20, 2012
    • Like x 29
    • Winner x 16
    • Useful x 2
    • Disagree x 1
    • Informative x 1
    • Creative x 1
    • List
  2. Offline

    Kainzo
    • Gold Donor

    Achievements:
    5
    Ratings Received:
    +61 / 15
    Herocraft approved
  3. Online

    midget_3111
    • Iron Donor
    • Stone Donor
    • Wood Donor
    • Dirt Donor

    Achievements:
    5
    Ratings Received:
    +94 / 23
    Shall be moving to this once a 1.1 stable build is out,
    Is this also how these things will work on the spout server?
  4. Offline

    Sleaker
    • Plugin Dev

    Achievements:
    4
    Ratings Received:
    +54 / 4
  5. Offline

    maniacmusic

    Achievements:
    6
    Ratings Received:
    +125 / 14
    Testing it, seems to work very well. Thank you!
  6. Offline

    croxis
    • Plugin Dev

    Achievements:
    5
    Ratings Received:
    +97 / 15
    For those of us stuck on small VPS are there any optimizations to be had in the ram department?
  7. Offline

    Afforess
    • Spout Team
    • Administrator

    Achievements:
    7
    Ratings Received:
    +858 / 86
    Probably not. I'd decrease your view distance.

    I have some proto-ideas on how to compress chunk data, but that is likely to be more of a CPU/File access boost than a RAM saver.
  8. Offline

    croxis
    • Plugin Dev

    Achievements:
    5
    Ratings Received:
    +97 / 15
    If memory serves chunks are loaded in a square shape around a player, so view-distance of 10 means 21x21 chunk area is loaded, or 441 chunks. Would it be possible (and not too complicated) to have chunks load in a circular shape instead? A view-distance of 10 would result in only 314 chunks loaded (a 30% savings!). Circular loading with a view distance of 12 is about the same as square loading of 10.
    • Agree Agree x 2
    • Useful Useful x 2
    • List
  9. Offline

    JoneK

    Achievements:
    1
    Ratings Received:
    +0 / 0
    How ever :( now my Massive farms won't grow.. unless there are less ppl online, tough they won't grow anyways when less than 10 tps

    Ouh disable "fast" or all redstone light updates from server side.
  10. Offline

    Afforess
    • Spout Team
    • Administrator

    Achievements:
    7
    Ratings Received:
    +858 / 86
    Turn up the number of chunks growth happens on. With vanilla and 100 players, it's rough 22500, so 5000 is not unreasonable.
  11. Offline

    DonRedhorse

    Achievements:
    5
    Ratings Received:
    +86 / 36
    well you and bergerkiller should get together... at least "bash" your head together on ideas..

    will look at the version when you publish the next one... looks like an RB is around the corner
  12. Offline

    Kainzo
    • Gold Donor

    Achievements:
    5
    Ratings Received:
    +61 / 15
    We will be doing some hardcore testing tonight on this - since =Herocraft= is now on 1.1
    Are the item config changes still toggable in the config in the latest? I really dont mind the changes and it does make the server lag a lot less.
    Afforess - will a plugin like NoLagg will decrease the lag as well as a cb-server side fix?
  13. Offline

    Afforess
    • Spout Team
    • Administrator

    Achievements:
    7
    Ratings Received:
    +858 / 86
    I have updated CB++ to the lastest CB code, enjoy. ;)
    • Like Like x 2
    • Agree Agree x 1
    • List
  14. Offline

    macman

    Achievements:
    3
    Ratings Received:
    +1 / 0
    Can anyone comment on how successful this is? With a in depth review?
  15. Offline

    Afforess
    • Spout Team
    • Administrator

    Achievements:
    7
    Ratings Received:
    +858 / 86
    Anecdotally, Herocraft uses this and can host 200 players with 20-15tps.
  16. Offline

    NinjaGrinch
    • Moderator

    Achievements:
    5
    Ratings Received:
    +177 / 26
    Just for the record, what is the usual TPS for Herocraft around 200 players when not using CraftBukkit++?
  17. Offline

    Inscrutable
    • Gold Donor

    Achievements:
    6
    Ratings Received:
    +77 / 9
  18. Offline

    BioRage

    Achievements:
    6
    Ratings Received:
    +111 / 18
    Mytatrea Approves!
  19. Offline

    BioRage

    Achievements:
    6
    Ratings Received:
    +111 / 18
    10 TPS
  20. Offline

    macman

    Achievements:
    3
    Ratings Received:
    +1 / 0
    Ok I like this, I used to barely get 10 TPS with 25+ players Now I get 20 all the time even when world editing.

    I fully recommend this.