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


    Did you read my latest test above? I wouldn't recommend it. May have something to do with how PEX loads now? I disabled WAR to see if it would fix but no changes.

    Edit: Like I can't open chests or dispensers after the server restarts.
  3. Offline


    @silentdojo I was just reading your post, were those newly generated chunks or.... I use a world boarder so all chunks are usually already rendered and saved and what not. Hmmm, see if you can dig further into it. I don't want to risk something like this with the amount of people I have coming and going in the server. This could cause some biggggg problems. It doesn't sound like a war issue.
  4. Offline


    I'll remove that onPlayerInteract function (which fixes lighting on clicked blocks), maybe it works. *uploaded
  5. Offline


    So I tried removing LWC and ModifyWorld (of PEX). No Change.
    After removing PEX completely I can now use chests, etc.

    Didn't notice before but I was also unable to break blocks.

    Edit: was in chunks already loaded.
  6. Offline


    @silentdojo The main unload part is causing no to little lag. Monitored how long it took to unload chunks - took around 3 ms max when unloading 60 chunks. This is pretty low for a task that runs every 20 ticks (40 in your case).

    it did stall with messaging, so something else is causing a tick loss. Not sure what.
  7. Offline


    so version and verdict?
  8. Offline


    v1.48.6 Works all fine for me. Maybe it takes some time to load all chunks around the player, and does this take a bit long if the player moves quickly. Nothing I can prevent...
  9. @bergerkiller
    After last updates... is your plugin really safety? And will my server get MUCH faster if I'll only use asynchronously chunk saving and chunk unload delay (60sec)?
    PS: Our server has more than enough unused memory so I think 60sec is a good value.
  10. Offline


    @VADemon safe...yes. Things like chunk loss or weird freezes don't appear to happen. It works best accompanied with the NoLaggChunks add-on, using it it was finally possible to fly around on normal worlds. (that is why I was stuck on Lowgrass since 1.8 came out ...)

    Note that most of these features are based on reducing client lag. Item buffering, stacking, buffered chunk packet sending, tnt buffering and chunk lighting fixes are all examples of this. Spawn limits, unload delays and async chunk saving help cope with tick rate drops.

    Next step would be async chunk generation and loading, but this could prove hard.
  11. @bergerkiller
    Itembuffering helps server a bit, I think. (But requires CPU)
    Hm, spawn limits. If I set low limit mobs won't spawn on my MobArena or? Any way to make it compatible with plugins as MobArena?
  12. Offline


    @VADemon it doesn't limit the mob arena. It only limits naturally spawning mobs
  13. Really? Nice!
  14. Offline


    @VADemon another FAQ, let's add it to the list. And yeah, it only limits naturally spawned mobs until you reload the server and it loses track of the custom-spawned mobs.
    Also, ItemBuffering hardly consumes CPU. It depends on the onItemSpawn event, which is pretty solid. It only performs an update to remove dead items from the internally stored lists, which takes little CPU to do. (it's a simple boolean check with some loops)

    Also, I know only one way to load chunks async, and that is by altering the view distance for chunks. I have no idea if this is possible, but if it is, then I can implement custom chunk loading queues.


    Yup it's possible. You can alter (through reflection) what view distance to use for players when loading chunks. It's the 'f' field in the PlayerManager. Will definitely look into this.
    VADemon likes this.
  15. Offline


    Where is 1.47 and 1.48 downloads? I only see a "non-recommended" 1.48.6
  16. Offline


    @NotYetRated that's the latest, and 1.47 had 'some tile entity wiping issues' so I decided to remove it. Until otherwise stated, 1.48.6 seems safe to use.
  17. Offline


    I'm using 1.48.6 and it seems stable enough. Haven't encountered any problems YET lol. I see tickdrop rates here and there but thats to be expected when people login. Might just need to experiment with settings I guess. Any suggestions for best configs?

    Seems I'm getting a lower tickrate with 1.48.6 at the moment but, as I said, could be due to settings so I'm unsure as to how things are going to go. I have 23 people on with average 14TPS which is lower then normal. Usually I'll have around 17TPS at lowest point. However that is without running the addon and spout.

    I have chunkunloaddelay set to 5000 instead of 10000.... could that be the problem?
  18. Offline


    @Eminam I experimented these things on my own server, and the main cause for tick drops are newly generated areas. Whenever I ended up exploring the wilderness, it started to spit out TPS like 2-9. When exploring already explored chunks, I hardly noticed tick drop, went from 20 to 19.7 or something.

    Also, I can almost guarantee, NoLagg is as tick-lag-limited as it gets. Monitored every event, none of them took longer than 0-1 ms to process. 1 ms caused by rounding and time calculation precision.

    If you notice an increase in tick rate if you disable chunk unload delays, then there has to be some sort of performance issue in one of the chunk handlers. You can always increase the 'updateInterval' to a higher value, it then performs item stacking and spawn limiting operations less often.
  19. Offline


    My server uses the Showcase plugin which allows users to display shop items on slabs... How would NoLagg handle those items? Would my users displayed items begin to stack and vanish from shop displays? Would there be a limit to the number of items that shops in a region could display? If so, is there a way to exclude a region from item qty checks?
  20. Offline


    All my chunks are already generated. I use world boarder so lol. It's not an issue with anything being newly generated. I was wondering if it was possible that perhaps with me having the chunk unload interval set to only 5 seconds if that could have been causing it. Which I don't think it would. Just thought it might be due to stuff being loaded/unloaded constantly type deal.
  21. Offline


    @robotmegacorp it has built-in functionality. (showcased items are literally invisible for the plugin)

    @Eminam neh it won't. Do you notice certain similarities when monitoring? (For example, a tick drop when the to save increases a lot or when you see a high unload/load chunk number)
    Depending on the size of the server, you may want to increase the updateInterval. The more entities, the longer it has to loop through them...
  22. Offline


    Lemme try a higher updateinterval. That could be the cause. I'll do some experimenting and what not and see if I can figure things out. It's probably something simple no less lol.

    What would you recommend for the updateinterval. It's a fairly large server so.
  23. Offline


    Kick ass!
  24. Offline


    Ok I was having some MAJOR lagg issues. I removed spout and the addon, fixed the issues...... and chunkunloaddelay is false so ........
  25. Offline


    @Eminam can only be Spout then, NoLaggChunks doesn't run on the main server thread; it runs on the network handler thread (most of the time) and in it's own thread. No idea what Spout does though...
  26. Offline


    yea for the lack of a better word, once spout was removed the lag stopped..... what does that tell ya LOL
  27. Offline


    It’s nearly impossible to get un expected bugs to occur on a single person server/ testing environment, the kinds of bug you’re talking about usually only come from testing with servers with at least 10 regular people that modify different and same areas over and over in a day. It is the loading and unloading that causes wipes like this as somehow the Meta data gets lost.

    So again if you’re testing solo you look for bugs that are easily found if it’s a bug caused by repetitive use of an area then you have almost buckley’s catching it on the initial release test.

    Though the above is true maybe it would not hurt to run a small public testing server so that potential issue updates could be tested over a couple days on a server that accepts public use ?

    Like above this issue is annoying as u can hound the developers of spout but they are likely to not do anything about it unless its reported via whatever method they use as a ticket system and usually only if it explained enough to be narrowed down or multiple users complain of same thing zzz I know I know.

    Same goes for bukkit wrapper tho the only way to get something done when u need it done is to learn java and patch it yourself, and then if you want u can try and submit a pull.
    bergerkiller likes this.
  28. Offline


    @ledhead900 Well said. :)


    A public server is going to be a bit hard, since port forwarding is failing. (tried it several times) I occasionally let others join using a local Hamachi network, but that's it. Plus it has a player cap of 4-7 or so the last time I checked. (could have become more of course)
  29. Offline


    Running 1.48.6 NL and NLC... hoping for the best!
  30. Offline


    Well if you want I can setup one at home on our webserver and host 5 or so
    just let me know of updates or if u want ftp ect. I can setup a admin panal for you.
  31. Offline


    Not sure why but we keep getting a message saying "[NoLagg] Memory used up for the log, may need server restart!" or something similar to that. And from what i can tell there is nothing wrong with our server and it wasnt doing this until i updated today from 1.32 to 1.48. Is there a setting i can adjust to make this stop happening?

    Sorry i cant get it to do it at the moment and i cant remember the exact wordage.

Share This Page