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


    Just curious, when moving back to 1.4.6, should the chunks addon be rolled back as well or is it okay to mix and match versions?
  3. Offline


    @Flatliner The add-on doesn't use the main plugin, but the main plugin (since 1.47) does use the add-on. But don't worry, it has fail-safe protection and disabled use of the add-on once it encounters an issue with it. So yes, you can roll back the main to 1.46 and use the chunks addon of 1.48. You can also use 1.48 main and disable unload delays, no wiping issues then either.
  4. Offline


    oh perfect, I didn't have unload delays enabled anyways so I'm all good :) thanks!
  5. All right! Thank you so much :D
  6. Offline


    I must have the biggest facepalm ever :mad:
                if (c.tileEntities.size() > 0) System.out.println("TILE SAVED!");
    Yes, it never EVER outputted 'TILE SAVED' in the console. Huzzah...

    Ok updated it, it should be fixed now. (and a lot of other stuff too)
    Can someone confirm that v1.48.4 works and does not wipe tile entities when the chunk unloads?

    In other words: it's sending a lot of chunks to update the arena for all clients, causing that crash. It must have to do with clients getting 'kicked' when reloading.

    This is all I get:
    17:05:39 [SEVERE] java.lang.NullPointerException
        at java.lang.System.arraycopy(Native Method)
        at Source)
        at Source)
        at net.minecraft.server.Packet51MapChunk.a(
        at net.minecraft.server.Packet.a(
        at net.minecraft.server.NetworkManager.g(
        at net.minecraft.server.NetworkManager.d(
    It's caused by the internal compressed packet data being null (so it didn't compress yet)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 10, 2018
  7. Offline


    Testing now @
    The tileentities seem to be saving even after a /reload in-game
    But afterwards chunk loading is very bad. Almost no chunks loaded around a player and the only show when u start to fall into them.

    Edit: when reloading from in-game u are instantly kicked.
  8. Offline


    @silentdojo Back and reload work just fine, don't get much issues chunks are loading either. Configuration?


    Kick occurs once a lot of chunks are being fixed from lighting issues and you do a reload. I'll fix that.
    Adrenaline likes this.
  9. Offline


    I tried this plugin and when my War plugin reset a map, every player was kicked to a blue screen
  10. Offline


    @shanko what do you mean with 'reset' a map?
  11. Offline


    it first saves an war-arena (after building) and when someone finished playing the war plugin resets all blocks in the arena back to the first save
  12. Offline


    Should I install spout on my server to use noLaggChunks?
  13. Offline


    @beleg you have to or it won't work.
  14. Offline


    I mean would it be better to use spout and nolaggchunks than no spout at all?
    So would it remove more lagg than spout will probably "create"?
  15. Offline


    @beleg Spout doesn't create lag, it's a very efficient plugin taking over native classes, so it hardly changes what was before there Spout. And I *somewhat* fixed the issue of kicking, if I let NoLaggChunks handle it all all goes swell, but if I decide to use the netserverhandler..ow boy :/
  16. Offline


    hmm okay so you cant give me classes for the craftbukkit.jar and I just replace them? :D
  17. Offline


    @beleg no.. xD
    Spouts network handling code is a bit too large to 'replace like that'.


    Ok great...Spout causes my NoLagg plugin to fail because it can't handle lots of incoming packets...
    If you use Spout with NoLagg, please also use the NoLaggChunks add-on, or it will cause issues with Spout. I'll re-upload .5

    @shanko does it crash if you use the War plugin solely with Spout? It appears to be a Spout-related issue.
  18. Offline


    ok i'll use spout and nolaggchunks soon :)
    is nolagg v 1.48.2 safe? (chests and signs...)
  19. Offline


    Great Plugin! but i have problem:
    Everytime i edit something with worldedit Nolagg tries to avoid lag.
    But i laggs like hell.

    So my question is:
    Is there a way to stop nocheat interacting with worldedit?
  20. Offline


    @zerstreut What type of lag do you mean? (guess I'll add it in the main page for your info)
  21. Offline


    Hows the updating coming along? Still having issues?
  22. Offline


    @Eminam Ow I got it sorted out. Saving issues are all resolved. I'll upload it now so you can test more...


    See the .5 new non-RB build. Feel free to throw everything at it you want.
  23. Offline


    So whats the word with nolagg and the addon with spout? One thing I had issues with was the chunk loading. It was EXTREMELY slow. This however has been with any build I used. This could be caused by my configuration as I left it all default with the exception of the chunk unload delay stuff. BTW did you fix all that with the .5?
  24. Offline


    @Eminam It's stable, but it needs testing of course. I verified (using lots of debug messages) that chunks are saved and after numerous testing (With spout, without spout, with addon, without addon) it no longer kicks the client when reloading. When reloading I simply skip the packet sending, preventing lots of chunks to be sent instantly. Also made it a bit more synchronized, as I believe that was the cause of the kick.

    It's hard to come up with a changelog, since most of it are bug fixes not really noticeable from the outside. For one, it now disables NoLagg before NoLaggChunks (added disable dependency list in NoLaggChunks) so it can use it when disabling.

    Now looking into firing ticks from another thread when a plugin is taking over control, to keep the server responsive while large edits are performed. This could be very unstable though.
  25. Offline


    What about the war plugin and its resets of zones? Everything ok there?
  26. Offline


    @Eminam didn't check it, but it can't be NoLagg in any way. NoLaggChunks is doubtful, since it didn't touch packets other than compressing them. If anything goes wrong, post the error you get in the log. If it's a NPE pointing towards Packet51MapChunk.a, then it's a Spout related issue. (something goes wrong when compressing the packet)

    In other words: if it only happens with NoLaggChunks installed, post here with the error (you should get) in the log.
  27. Offline


    I haven't seen any errors with nolagg chunks, I have seen many errors using spout before, can't remember what the errors were. I do know I've seen errors with it though lol. Can you tell me how these current configurations look, and possibly how to improve them to produce better performance overall from the server? A minor note: TNT is disabled on my server so the explosion stuff isn't important.

    Nolagg plugin

    autoSaveInterval: 400000
    explosionRate: 5
    useSpawnLimits: true
    tntDetonationRate: 10
    bufferTNT: false
    bufferItems: false
    useChunkUnloadDelay: false
    updateInterval: 40
    tntDetonationInterval: 1
    chunkUnloadDelay: 3000
    formItemStacks: true
    maxItemsPerChunk: 40
        mob: 1501
        animal: 750
        monster: 750
        squid: 1
        mob: 1000
        animal: 0
        monster: 1000
        squid: 0
    stackRadius: 5.0
    stackThreshold: 2
    monitorInterval: 40
    Nolagg addon

    chunkSendInterval: 4
    chunkSendRate: 1
    chunkViewDistance: 10
    chunkDownloadSize: 5

    ForceSinglePlayerClientKickMessage: This server requires Spoutcraft!
    AuthenticateSpoutcraft: true
    TeleportSmoothing: true
    AllowCoordsCheat: false
    AuthenticateTicks: 200
    AllowClearWaterCheat: false
    AllowStarsCheat: false
    AllowTimeCheat: false
    ForceSinglePlayerClient: false
    AllowEntityLabelCheat: false
    ChunkDataCache: true
    AllowSkyCheat: false
    AutoUpdate: true
    AllowWeatherCheat: false
  28. Offline


    Just wanted to say I'm testing 1.48.5 now so I'll let you know. I do use the War plugin as well. Also you may want to remove 1.48.2 so no one else has issues with that.

    So far I've been happy with the chunks speed. Only problem I can still see (happened on older builds) is that when I fly to any chunk, allow all the other chunks unload, the radius of chunks around me is loaded, when I then leave to fly again, chunks will not start to load until some are unloaded.

    It seems like when you want chunks to unload faster I turn around and look in the distance and they finally start to unload faster. Other than that I think chunkloads/unloads are great.

    Tileentities are saving properly.

    Biggest issue: After a restart I was unable to use chests, dispensers, and beds until i did /reload in-game (which works now). I am op and have an * node in PEX. I may have did a reload in game first then a few minutes later simulated an auto restart. But fact is I can't interact without a reload.
  29. Offline


    @silentdojo mh yeah forgot to remove it, thanks.
    I have the chunkSendInterval at 2, which works really well. 4 is a bit slow, but it depends on your connection. If interval: 1 is even too slow, you can upper the rate, that's what it is for.

    Isn't 5.5 hours a bit long for a save interval? Don't forget it's async, so no loss of tick speeds there. I use 1000 on my server. Using unload delays could reduce the chunk unload lag, since it then uses async save when chunks unload.

    Ok tried running a second 'tick syncing' thread, didn't work out. It caused concurrency errors on the main thread, causing it to crash horribly. It was then running on my own thread all of a sudden - but a lot slower of course...

    I could go and 'keep players alive' to prevent them getting kicked, but what use does it have being on a server where you can't chat/place blocks/load chunks...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  30. Offline


    so 1.48.5 should be good and stable? just want to make sure
  31. Offline


    @Eminam yup, it should be safe and stable.

    @silentdojo The reason why chunks stop getting received is because it is still loading the chunks you are in. If you wait for a bit, it will look as if you go really fast, but in reality you are just fast-receiving the chunks previously processed. It is already at the max as it is now, maybe some pre-loads/generates but that's it.

    What exactly do you mean with 'can't interact'? As in, an error appears in the console or just blocked-out? It's a bit vague.

Share This Page