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


    @Sorken weird, what you just described worked perfectly fine here xd

    @vicente947 working on it, you can disable NoLaggChunks for now if you want to fix it.
  3. Thanks i will do it this
  4. This is with a radius of 2.0. Rotten flesh in both piles total at 29 and still not merging. LWC magnetic chests the cause?

  5. Offline


    @Sorken what if you increase the stacking radius a bit more? Right now it is over 2.0 block distance.
  6. Offline


    The plugin checks for the number of stacks in the radius, not the number of items itself. Thats it.
    If there are 5 little stacks (mb with 2, 3, 1, 1 and 6 items in each of same type) they will get stacked again, if the threshold was set to 5.
    But a new item won't get added to an existing stack.
  7. @bergerkiller that does seem to work. Its as if the items are located at the extreme edges of their blocks. Causing a need for longer radius.

    What about tnt drop? My problem isnt really people setting off 50 tnt but rather the drops that come after. I dont want to string my exposions. I want it all in one go but i would rather the drops be put into stacks of types and then scattered if possible. Id rather have a little over 15 stacks of dirt then 1000 dirt blocks everywhere :)
  8. Offline


    @Sorken you can buffer items too. Buffered items in chunks spawn as a single stack if stacking is enabled. You can set the maximum allowed amount of items per chunk in the configuration.
  9. Yes, but id rather not do that. Dont want to risk things getting stuck in limbo until a chunk clears out and being missed by the player as 'gone'. Better to have tnt drop stuff politely :)
  10. Offline


    @Sorken A tnt block will detonate around 30 blocks max, this is not really much. Most of those will get stacked automatically, to let's say 10 items on average. Don't really see a use in stacking all items for such amounts...and it would look similar to chunk stacking/buffering
  11. Stop talking :mad: and fix the problem with sings :p
    Is a joke.
  12. Offline


    @vicente947 I am a multi-tasker, listening to music while running a server while running MC while chatting while regularly fly around on the server while monitoring CPU and RAM usage. So don't worry xd
  13. I AM VERY PATIENT :mad:

    certainly i love your plugin

    I use your plugin since initial version

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  14. With the diffrence that it actually has to drop every block individually and then merge them all, instead of spawning premade stacks of right size.
  15. Offline


    @Sorken I see...ow well I'll see if I can keep a list of blocks to spawn and perform a stacking algorithm over this list, and then spawn them.

    Also, the sign text issue is weird, it only seems to happen at random. sigh...

    @Sorken you can upper the tntDetonationRate to do that. It would then fire all those TNT in one tick. Interval must be > 0 or it fails.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 10, 2018
  16. @bergerkiller ofc, any problem not defying logic and randomly appearing wouldnt be worth having :)
  17. Offline


    Ok for some reason, if I set the timestamp packet property to the current time, RIGHT before sending, it fixes the issue. It's so vague to work, but I'll test a bit more to be sure.


    I can't obtain the item to drop during explosions (damn you Bukkit, why did you keep that method protected?!). I will, however, add a method to stack items when a new item is spawned. This will speed up the stacking process.

    Ok updated it to 1.49.1, changes:
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  19. Offline


    All seems to be working fine so far, I think you may have finally cracked it! Nice work!
  20. @bergerkiller
    Thank you :)

    Can tntDetonationInterval: 0 be used to detonate tnt in same tick, ie like server normally does? Cause im getting alot of drops destroyed by the tnt.
  21. Offline


    Still fighting with the tnt.
    No matter what settings i choose, it will mostly end like this: [​IMG]

    Triggered TNTs wont stop increasing and the TPS is going to die.
    Config1 (open)
    tntDetonationInterval: 1
    tntDetonationRate: 30
    explosionRate: 30

    Config2 (open)
    tntDetonationInterval: 60
    tntDetonationRate: 30
    explosionRate: 30

    There is somehow no difference between these both configs, just the time elapsed it needs to kill the server with 500k blocks tnt. (Config1: Just few seconds ; Config2: 'bout 10 seconds).

    Thought there should be any limit for the triggered tnt, shouldnt it?
  22. Offline


    @Sepulzera well for every TNT that gets affected by an explosion, it stores the block location in a list. if it, while detonating the TNT, encounters a block that is not TNT, it will ignore that one and continue with the next. So, it will keep on increasing, but will rapidly decrease as well. The amount of TNT you get to see 'buffered' is about the area of the visible bit of the TNT. Not sure why the TPS dies though, did detonation with 100K TNT stacks before...
    What if you set the rate to 10 or something? (10 tnt per tick)


    Ah I see what you mean. List gets gigantic and causes a tick drop (somehow)...
    It's the amount of items that causes the tick drop. Even after everything exploded, I had 2000 loose items hanging around. These were causing a massive tick drop, probably because of the stacking alghorithm. (it has to loop through 3000 items for every item = lag)

    Best is to set an item spawn limit, I'll see if I can somehow exclude groups of items in the stack coding, or make the stack coding async (even better)
  23. Offline


    Like I've mentioned before: The settings don't really matter, they will just increase the elapse the time.
    Ah and yes, I've tried with a rate of 10.

    Dunno what's causing this, but probably not my system (the server only got 3GB Cl9 ram and a i5-2500k).
    Guess I'll search a plugin to disable physics like water and such stuff, and to remove orbs only (nolagg clear will clear tnts either, but it doesnt really help here^^)

    And btw: with a rate of 10 I got about 5k triggered TNT (or whatever it is in the [ENTITIES]-line of /nolagg monitor), with the configs posted above just 3-4k.
  24. Offline


    @Sepulzera what if you set a default world spawn limit for items? (around 300 or so) or set a chunk max.
  25. Offline


    How can I set a default world spawn limit for items?

    Btw: I doubt this issue is related to the items. Tried it now in a box of bedrock, so there couldn't spawn any items.
  26. Offline


    @Sepulzera did this happen since 1.49.1 or not?
  27. Offline


    Well, I thought it didn't exist in previous versions. But now I encounter this issue with p.versions, either.
    Probably as I didn't placed 500k TNT before, just 100k-200k. ;)
  28. @bergerkiller
    OK, raised rate to 100, set off 4 tnt (at same time) which blew up 466 blocks. Total drops were 50 dirt and 4 cobble. Obviously some blocks arent dropping.

    bufferTNT: is only for buffer drops from tnt right? So if theres too many drops in a chunk it will save em for until its okay to drop em?

    bufferItems: false
    bufferTNT: false
    useSpawnLimits: false
    useChunkUnloadDelay: false
    tntDetonationInterval: 1
    tntDetonationRate: 100
    explosionRate: 5
    maxItemsPerChunk: 100
    formItemStacks: true
    chunkUnloadDelay: 10000
    autoSaveInterval: 400
    updateInterval: 20
    stackRadius: 1.7
    stackThreshold: 2
    monitorInterval: 40
  29. Offline


    @Sepulzera Currently wondering what alternatives there are for that TNT 'tick' list. Might just add a separate TNT list per chunk, per world, and store the TNT block locations as a single integer. May need to look into Java lists a bit more, to see at what point lists start to take up CPU. It could even be lag caused by endless cycling through the blocks, which turned to air. Then I need to *somehow* replace that list with a sorted hashmap type of thing...

    @Sorken that is correct, in native coding the world random is used to find out if an item is dropped. This means that TNT-drops will always be less than if you'd break them manually. Not my coding (error), I just mimic what's in MC's server source. :)
  30. @bergerkiller
    Okay, ill buy that. But still, im getting several small stacks of dirt.. 4-6 of them from a small blast with 4 tnt. They are all small enough to be able to go into one stack yet they dont. And the explosion is in small tight area. I dont see why it splits them up.. or rather not merge them together fully.
  31. Offline


    @Sorken completely depends on the stacking radius. Using a radius of 5 would make it certain that everything gets stacked, but it might be a bit annoying when dropping items.

Share This Page