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. 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. :)

    Important:

    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

    Description

    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.

    Read more...

    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.

    Read more...

    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. :)

    Read more...

    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.

    Read more...

    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.

    Read more...

    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.

    Read more...

    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)



    Media



    Video by brandcool86


    FAQ

    - 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.

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

    Changelog

    Show your appreciation for my plugins by donating
    [​IMG]
     
  2. Offline

    B3NSL33P

    looks liek a great plugin but would it stop my server crashing when i set off 64 tnt ??
     
  3. making a video where I ignite 7000 tnt. :)

    Also, @B3NSL33P it will take approx. 4 seconds to ignite 64 TNT if set to 20 TNT per second.
    (4 waves of explosions)
     
  4. Offline

    owenftw

    i will try this out when recommend bukkit build comes out for 1.8 :D ty
     
  5. Offline

    ichingpow

  6. Offline

    8Keep

    Looks amazing. Finally I can enable tnt again without the worry of some **** crashing my server!

    Thank you, installing right now on the dev version of 1.8 bukkit.
     
  7. @ichingpow good idea, I will implement a 'keep chunk loaded' feature to the least, I'll see how he did it and add appropriate credits to @LexManos Not sure about the monster limiter, I'll see if it fits this plugin nicely. beforehand: monster delimiting per world specific or globally?

    MyWorlds allows you to deny certain mobs from spawning already, I could also extend that instead.
     
  8. Offline

    guthixpoke

    wheres the jar file???
     
  9. @guthixpoke top page, download from github, save as (DON'T open it) and place the file you downloaded in plugins. I'll add an archived version later on. (for v1.1)

    Updates: Added 'keep chunks loaded for a longer time' and 'global entity spawn restrictions'.
    Spawn restrictions can be set globally AND world-specific.
     
  10. Offline

    AbeJ

    So it's basically an event queue? I like it. I'll put it on my server.
     
  11. Offline

    dwi

    How about mob traps? How will it behave, when a lot of items will be dropping from mobs in killing room and moving to the collector room by water delivery system?
     
  12. @dwi well you need to pick em up, once you pick them up the hidden/buffered items will simply spawn again. (as a stack, hey how simple)
     
  13. Offline

    dwi

    @borgerkiller: Oh, so effectivity of mobtrap will be drastically decreased, if items dropped in killing room will be waiting to spawn, until rest of items get to collector (in matter of 40-60 seconds for example) where player picks them up and he will need to wait another 40-60 seconds for another batch of 40 items?
    Thats quite hard solve this situation :/
     
  14. @dwi yeah that can happen...unless you set the item limit to around 60 then nothing really happens. You'd have to set the maximum allowed items per chunk to such a value it won't harm your trap, not entirely impossible. :)
     
  15. Offline

    EnisThenis

    Does this work with EXP orbs?
     
  16. Offline

    EnisThenis

    Easy install and commands. Had 1000+ orbs on the floor causing mass lag on SMP. Installed this and could pick them all up within 5 seconds.
    Just wondering, is there any chance /nolagg clear could also work with the orbs?
    Great work.
     
  17. @EnisThenis it should, but could also be the orb is not an item. I'll look into it. :)

    Also, updated to 1.1 adding some features requested by @ichingpow
    Auto-save stopper not yet added (NO idea how that is possible from within a plugin), did add the delayed chunk unload stuff.
     
    EnisThenis likes this.
  18. Offline

    EnisThenis

    Just an update on the orb problem, download this mod to reduce the lag it causes, gather all the orbs and jump into lava which will burn them.
     
  19. Offline

    Fr0zenfr0g

    cool, continue with this!
     
  20. Also, I see from the PerformanceTweaks plugin that the auto-save stopper simply consists of changing a (hidden) variable for all worlds. Guess it is time to implement something like this for 1.11...
     
  21. Offline

    Fr0zenfr0g

    i have just try this plugin out, is it posible to add a thing like this with tnt to worldedit, that would be epic.
    fantantastic plugin :D ***** a five star plugin
     
  22. ...and it was THIS close to never getting published... :eek:

    @Fr0zenfr0g Not sure about Worldedit and/or if it allows external plugins to access it, what Worldedit-related features did you have in mind?
     
  23. is there any downside to this?
     
  24. Offline

    fysics

    Please leave this disabled by default. The auto-saves serve an important purpose. When your server crashes unexpectedly, it does not perform a save first, and everything is reverted to whenever the last save was.
     
  25. Offline

    1994mat

    Another great plugin :)
     
  26. Offline

    LexManos

    Just figured i'd drop this here if you wanted to use it.
    Code:
    			java.lang.reflect.Field saveInterval = net.minecraft.server.World.class.getDeclaredField("u"); //This changes almost every major release of MC, where World.class is changed,
                                                                                                         //you find it by going into World.doTick() and looking for
                                                                                                         //if (x % this.{someVarible} == 0) save(false, null)
    			saveInterval.setAccessible(true);
    
    			int time = cfg.getInt("interval", 36000);
    			for(org.bukkit.World bworld : mPlugin.getServer().getWorlds()){
    				CraftWorld cWorld = (CraftWorld)bworld;
    				net.minecraft.server.World mWorld = cWorld.getHandle();
    				saveInterval.setInt(mWorld, time);
    			}
    But, be warned, putting this is brings out bitching and moaning from people who do not understand what is actually going on. *cough*fysics*cough*

    But it's nice to see this type of thing in a clean version.
     
  27. Offline

    Fr0zenfr0g

    You may know when you are editing a massive Amout off blocks, then the server gets unplayeble and it takes a long time before the players can login again. I "just" wodering if it is posible to add a max edited blocks/sec or something that prevents lagg...
     
  28. @Fr0zenfr0g All I can think of is replacing all blocks with my own and handling the setType functions, or implementing a custom network handler like Spout does. Other option is to send network packets Async to all players when the tick delay becomes too large. Changing blocks properly is actually up to the guys that make them, such as Worldedit.

    @LexManos Yep I saw somewhat the same in your source code, but I ended up having NO idea what hidden variable I have to change. (names got turned around in 1.8) So thanks for clarifying that. :)

    @fysics I'll read the default from the world in onEnable when first writing out the variable so the default save interval is the same as the default, and not a pre-defined number like 30 minutes.

    @DT_Rush Downsides are:
    - You will need to increase the amount of items per chunk to make it compatible with mob traps. (items will spawn in stacks and come to you in long intervals)
    - It takes AGES for TnT to explode. Increasing the amount of explosions per second can help, but could make the server unplayable.

    Also, still working on the TnT tick-syncer. I want to detonate the TnT per-tick so it will spawn less lying-around TnT entities. (which, in turn, could lag the server anyway)

    Edit

    Ok auto-saver ready for duty. Made it as resilient as possible.
    Code:
        private static boolean validate(String fieldname, int checkvalue) {
            try {
                saveInterval = world.getDeclaredField(fieldname);
                saveInterval.setAccessible(true);
                if (saveInterval.getType() == int.class) {
                    for (World world : Bukkit.getServer().getWorlds()) {
                        defaultInterval = 0;
                        defaultInterval = saveInterval.getInt(getNative(world));
                        if (defaultInterval == checkvalue) {
                            newInterval = defaultInterval;
                            return true;
                        }
                    }
                }
            } catch (NoSuchFieldException ex) {
            } catch (Exception ex) {
                ex.printStackTrace();
            }
            saveInterval = null;
            return false;
        }
        
        public static void init() {
            if (validate("u", 40) || validate("p", 40)) {
                System.out.println("[NoLagg] Auto-save field bound to '" + saveInterval.getName() + "'!");
            } else {
                System.out.println("[NoLagg] Failed to bind to the field to enable Auto save changer!");
                return;
            }
        }
     
  29. Offline

    in0de

    It seems work okay with dropped items.
    but doesn't eliminate the lagfest caused by orbs as I tested.
     

Share This Page