Inactive [FIX/ADMN] NoLagg v1.88.1 - Prevent common lag causes on your server [2338]

Discussion in 'Inactive/Unsupported Plugins' started by bergerkiller, Sep 17, 2011.

  1. Offline


    I had already made this plugin before after having a major lag issue. (lots of torches being filled, turned into items, lag for 20 minutes) It also works for 1060.

    Some feature ideas are taken over from PerformanceTweaks by @LexManos so some credit goes to him. Code, however, written from scratch by me. :)


    If you get a warning message [NoLagg TLN] followed up with a stack trace in the log, this has to do with the main thread not having responded within 10 seconds. When a plugin takes more than this time to enable, it will show that. The warning is NOT an error and is no bug, and not a bug related to NoLagg. To disable this feature, disable 'threadlocknotifier' in the config.yml. This feature is mainly intended to notify you what plugin is causing the server to freeze, may it ever happen. It is used to debug plugins in general, as they may get stuck for whatever reason.

    NoLagg's features in a nutshell


    Prevent lag caused by many items

    Every time an item gets spawned, it is buffered per chunk. For example, you spawn 30 items using Q and the maximum allowed items per chunk is 20, then the 10 remaining items are not spawned. They are spawned as soon the item count in this chunk is < 20 again.


    Form item stacks - fully automatically

    Whenever two or more (configurable) items or experience orbs get near each other, they form a single stack of that item type. If someone drops 64 dirt blocks on the ground using Q, it will show a single item of 64 dirt instead.


    Prevent lag caused by TNT

    This plugin takes over tnt ignition caused by explosions. When exploding stacks of tnt, it does not rush all tnts into a single tick, but detonate them nicely in sync. This results in pretty awesome fireworks. :)


    Prevent lag caused by lighting glitches

    Whenever a new chunk is generated, it's lighting information is generated and all nearby players receive the updated chunk data. If the auto-method fails, you can use /nolagg fix to do it manually. This fixing fixes, for example, dark spots in and around caves lagging the client.


    Set entity spawn limits

    You can set a spawn limit on virtually every entity in the game. From mobs to items to TNT. Only thing being excluded is Players, since I can't simply kick someone 'like that'. :)
    Note: It removes already spawned entities too. So, if you want to keep your animals alive, don't set mob or animal limits, or it will possibly clear your farm animals. (or you can disable the spawn limiter all together)

    I recommend finding an alternative plugin for this instead. Removing entities after they are spawned causes more lag than it prevents!

    Global auto-saver

    Since asynchronous chunk saving is now implemented internally, it is no longer a problem to save entire worlds frequently. You can set auto-save intervals in the configuration. If used with an interval higher than 400 ticks (20 seconds) it will use a scheduled task instead of the internal saver to prevent chunks never getting saved. Another benefit is that player information is also auto-saved, preventing your players losing their inventory state.

    New chunk sending mechanics

    Instead of loading chunks all around the player, the player direction is used to load the visible chunks first. This means that players can expect chunks in front of them to load quickly, while chunks on the sides take a bit longer to appear. When the player looks into another direction, the direction changes and thus the new visible chunks get loaded first. Only if all chunks ahead of the player are loaded, chunks around the player are sent. This all can be configured using a simple minimum and maximum sending rate.


    Examining the server tick rate

    If you encounter very low tick rates and you want to find out what plugin is causing it, you can use the examine component to find it out. It comes with a graphic viewer, which makes bug tracking the easiest thing ever.


    Prevent cross-thread access for events

    As it seems, some plugins don't follow the rules and use Bukkit methods in another thread. This plugin will notify you and cancel if possible whenever this happens so other plugins understand their mistake. If you encounter a lot of spam in the console, first check the stack trace for the plugin that caused the error. Report this error to the author or remove the plugin, if you have questions you are free to ask.

    Configuration (on BukkitDev)

    Commands and Permissions (on BukkitDev)

    Synchronized code accessed by another thread? (BukkitDev)


    Video by brandcool86


    - Help I experience missing chunks
    If you are using Spout, don't use Reloads. This is also the reason why Spout added a warning when a player tries to reload the server. Not using Spout, then it's a bug which you can report.

    - Can this plugin be used with PTweaks
    (this message was really old...) Yes, they are compatible, but if certain features overlap, make sure you disable these features in either plugin.

    - I get a warning about the async auto save and interval. Wat do?
    Change the autoSaveInterval value in the configuration to a value higher than 400, like 600. The warning is to prevent endless autosaves to occur, clogging up CPU.

    - I have experienced CPU usage
    CPU usage is not the same as lag. NoLagg uses multiple (2-3) extra threads to prevent tick and network lag. If a lot has to be done, it does this quicker, but this takes more CPU obviously.

    - I have lag when using NoLagg
    See also the FAQ above. Explain what type of lag you have: tick lag, client lag, network lag and/or 'block placement' lag. You can use /nolagg monitor to check the tick rate. If this is normal (>15), then you have network lag. Client lag is when the FPS drops. Block placement lag is lag when the tick rate is normal and other network messages, like chat, are instant.

    - WorldEdit causes lag...
    YES because it is unsafe to take over the main thread while another plugin is having hold over it. I can try fixing this, but it could ultimately lead to some serious concurrency exceptions. Don't expect this to be implemented very soon...

    - Do spawn limits interfere with mob-spawning plugins like MobArena?
    No, it does not. It only limits mobs spawned by 'nature': all custom creature spawns are ignored throughout the run of the plugin. Only after you reload will it lose track of these entities and will it remove custom-spawned mobs. If you use MobArena, be sure nothing is going on when you reload the server.

    - Does item stacking interfere with Showcase or BleedingMobs?
    It supports Showcase and ShowcaseStandalone entirely. (showcased items are completely ignored at all times) The same applies to the 'particles' created by the BleedingMobs plugin. Know of a plugin where it stacks items which should not be stacked? Post the plugin name so I can add support. You are an owner and want to add support? Only having a function in your plugin to check if an item is 'ignored' is enough.

    - Can this plugin be used with Chunk Manager
    If you want to use the Chunk Manager with Nolagg, disable the chunk sending of Nolagg first. If you don't do that, this plugin will do that by itself and send a warning in the log. Of course, compare the results first. :)

    - What are the best settings if I have a lot of RAM memory?
    This plugin does not deal with reduced RAM memory. If I could, I would, but you simply can't reduce the amount of memory Java uses. This data is locked and secured, so I can't simply throw away bits of data or write and read data from/to disk. Any plugin claiming to reduce RAM usage on a server, is probably 'garbage collecting'. This fakes having less RAM usage by removing unused data, but Java does this by itself as well once it hits a certain limit. All these plugins will do is make the Garbage Collector run in overdrive, which will only kill your tick rate and/or CPU speeds. A bad thing.

    - I get a lot of 'Synchronized code accessed from another thread' errors
    Find out what plugin is acting up by inspecting the stack trace. If the plugin that causes this is inactive, all you can do is wait for a refurnished version or someone to fix it for you, or use an alternative plugin. If it's still under development, notify the author of this, it IS an error caused by that plugin. If you can't find out the cause, PM me or post in this thread.

    Before you begin writing a lag issue

    This is very important, just posting a 'it causuz lagz und shitz' won't do, won't help and I won't be able to help you any further either. Question is if I even want to help you, if you post such a message without anything worth looking at. Things to include in your message:
    - Errors in the log if possible
    - What CB version you use and what NoLagg version you use
    - When this lag occurs. Tick rate drop in general?
    - The configuration you used when running this plugin
    - What type of lag if applicable. Options are: tick lag, client lag, network lag (see above)

    Important links

    NoLagg Download page and others at Dev Bukkit
    View the source code of NoLagg at GitHub

    Use an archive extracting program (WinRar, WinZip) to open the archive.

    - Add option to disable physics when the tick delay becomes too high


    Show your appreciation for my plugins by donating
  2. Offline


    majow The chunk packet buffer is basically the amount of memory currently allocated for the creation of chunk packets; a single 'packet' containing world chunk data for the players. This value will rise if needed, and every 10 seconds or so it will perform a simple garbage collect, and then the value drops again. It is used to limit the amount of new memory data requests to smooth the memory usage.

    If you use the item stacker, note that it currently has a severe memory issue. It uses 40 * <itemcount> * <itemcount> kb of new memory every update interval. With 1000 items this is 40 mb. This is now resolved in the version I am now uploading on github. (1.62)
  3. Offline


    totally solved the problem, thank you again!

  4. Offline


    Is it recommended to run a /nolagg gc command every minute? I find that it kills memory leaks.
  5. Offline


    sagethor nope, I strongly dis-recommend it. Only use the gc command to obtain a snapshot of the 'static' memory; the memory that will never be freed. It is no problem if the memory usage increases up to 3x the actual used amount, since this memory will be cleared automatically anyway.

    The JVM performs these garbage collections by itself, so no need to do it manually. High memory usage =/= Low performance, it's the rate at which memory increases that is important.

    Averus What is the 'update' duration when spawn limits are enabled? If this is < 2 ms, I am not sure what to expect...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Dec 28, 2018
  6. Offline


    Alright, that's what I was trying to ask you earlier. Would setting benchmarks every five or ten minutes be alright?
  7. Offline


    sagethor sure, if you want to check the state of the memory you can do that.
  8. Offline


    When using Orebfuscator and NoLagg together; Should I keep Orebfuscator's threads to 1 in the config or more? While I have NoLagg's threads at 3 and Orebfuscator at 2; everything works fine while not flying around too fast (25+ people online).
    Wondering what you would recommend these settings should be for best performance.
  9. Offline


    silentdojo Use 1 thread in orebfscator. Since everything will run on my local threads, his threads will do nothing 24/7 or maybe do something now and then.
  10. Offline


    Hi, its me again
    NoLagg 1.62
    useEntitySpawnLimits: true - 1500 mobs (limit) 12-15 tick/sec 40+ ppl
    useEntitySpawnLimits: false - 3500 mobs 19-20 tick/sec 70+ ppl
    (updateInterval: 80)
    have i nice day :)

    update 0.1 - 0.3
    off its 0.1

    "EntitySuppressor" plugin its best way for limit mobs without tick rate drop for me, its open source you can see code.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Feb 15, 2019
  11. Offline


    Averus I had the exact same strategy before; cancel the mobs spawn events. But it simply doesn't work.
    The problem is that new chunks load, chunks with entities, which adds to the total mob count as well. To effectively clear them, I have to clear these chunks too. Even then, some entities could have died, and since no entity despawn event is present I have to regularly update the spawn limit counter. Note the 'spawn limiter update duration (green)'

    If you have lag with it, you can increase the update interval in the configuration, it then performs these recalculations less often.
  12. Offline


    bergerkiller =/ I really don't like how my updater "(chnk updtr took longest)" isn't staying at 0.0-0.1ms like it use to. I even have all the features disabled in nolagg and it still goes up.

    Even so, after a few hours, it shouldn't be at 600+ms. It use to be 0.0-0.1 in the 1.58-1.59 update, always constant.

    Edit: Can you look into the issue and possibly upload your bklib 1.04?

    Edit2: Also, using Bklib 1.03, it states it is version 1.02 in the console.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Feb 15, 2019
  13. Offline


    bergerkiller, you're simply the best! :)

    Well, one suggestion: can you make a version for CraftBukkit++ (a CraftBukkit modded, by Spout team)? :D
  14. Offline


    rtcabooservb If all features are disabled, it still spends some time unloading chunks that are no longer in use. This is done to prevent chunks staying loaded all the time, it takes some processing time to do all that.

    Not needed, you can disable the features in NoLagg that cause problems anyway. It's not really needed, since performance fixes are internally applied there as well.
  15. Offline


    hi whats the "BKCommonLib"
  16. Offline

    Don Redhorse

    a library bergerkiller created which he is using in all of his plugins.. saves some work
  17. Offline


  18. Offline


    rtcabooservb is it that much? What is the memory/total when that happens? I have a feeling there is yet another memory leak going on somewhere...
  19. Offline


    Appears to have some incompatibility with Oresuficator, but that's alright - I only use it to hide chests.
  20. Offline


    How do u download it! Im ooking for a clear download link but instead i get the source code!
  21. Offline


    What incompatibilities are you seeing? I'm using Orebfuscator 1.3.5, NoLagg 1.62, and CB 1920. I don't get any errors, and both plugins seem to happily do their thing.
  22. Offline


    After numerous hours and 30+ people on during the /lag stat, I am currently at 1519/12221.
  23. Offline


    I deleted the world cache and world to regenerate another. I experienced a chunk error with it interfering with a Nolagg thread, making chunks be different from other chunks around them.

    Occasionally there's another error; maybe it doesn't like new worlds - it showed the error while chunks were still generating.
  24. Offline


    bergerkiller Besides the awful updater ms going to 600+ms, I've also been experiencing this again.


    Again, I didn't have these issues in 1.58-1.59. So whatever you changed, chunks turn invisible now like they use to and need you to go right up to them to update. I didn't have this issue in 1.58-1.59. Also the updater ms going past 600ms when it use to be 0.0-0.1ms under every circumstance.

    CB 1921 Spout 749

    Default config except mob limits are disabled.
  25. Offline


    trying updateInterval: 360 still lags, i need more? i told you - turn it off and i have +2-3 tick/sec do something plz.

    Nolagg produs lags, hm...
  26. Offline


    rtcabooservb The monitor doesn't re-set the value if it's not monitoring. So when using /lag stat, it will show the time since the previous time you uses /lag stat. /lag monitor should give an accurate result. I'll make it reset the times in the next version, if when not monitoring.

    Averus Then use entity suppressor, I have no problems with it if you disable it in NoLagg. I wrote it, and I know that it doesn't suck. It accurately limits the mobs at all times, and even updates the counts regularly. I can't do what entity suppressor does (limit mobx and moby and mobz), since my system is too advanced for that. It keeps a set of limiters for every entity; every entity has it's own limiter containing spawn limits global, world and grouped versions of that. It also limits non-mobs, such as minecarts, items and arrows.

    I do know that the server tends to keep on spawning new mobs when the limit is reached already. It is possible that this endless spawning and de-spawning is causing some tick lag. The only solution to that is to enable/disable animal/mob spawning in the worlds, or to supply a custom mob spawning script. This is too tiresome, since it has to be done for every environment.

    Also, nothing 'sux'. It is all about the requirements a system has. If it has to perform global limits for EVERY entity (and not cancel creature spawn events, and that's it), you can expect it to require more processing time.
  27. Offline


  28. Offline


    sagethor the author is really responsive, but unless you can provide the actual errors you describe (like providing a link to a pastebin or something similar), there isn't much to work with.

    Suntownkid I did! It works great! :) If you're looking for the download link, look near the bottom of the OP, under "Important Links"
  29. Offline


    with 50 ppl i have 3500 mobs with NoLagg off (19-20 tick/sec)

        mob: 4000
        animals: 1500
        item: 200
        monsters: 1500
    with mob limit on i have 12-14 ticks/sec
    maybe you forgot about "spawn-npcs=true" in server config...
  30. bergerkiller
    Does mob-limiter also affect mob spawners? Cuz we have guys (gays) who're afk over a long time and they spawn hundreds of mobs.
  31. Offline


    VADemon the latest version also adds 'mob spawner block spawn limits', in there you can set alternative limits for mob spawners. The general spawn limits do not affect mob-spawner-spawned mobs.

    Averus can only really think of the endless respawn cycles though...does disabling monster/animal spawning on the worlds fix this? (server properties: allowanimalspawn and allowmonsterspawn false)
    If this doesn't get rid of the lag, then it is something else. if it still lags, it must be something else...

Share This Page