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

    bergerkiller

    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

    bergerkiller

    @in0de what's the best way to reproduce this when being alone on a server? (a.k.a. get a lot of orbs to spawn)
     
  3. Offline

    fffizzz

    go monster hunting and gain a crap load of xp, then kill youself.
     
  4. Offline

    bergerkiller

    @fffizzz me I'll just give myself a crap load of xp through bukkit...lol

    Btw this version contains some bugs, I am fixing them atm.

    Awesome note: going to add somethng unique: live item stacking. If an item finds a nearby item he can add to itself, the other item is removed and it's amount is added to itself. So, if you drop two pieces of dirt on the ground, they will turn into a single stack of 2 dirt. It is pretty awesome. :)
     
  5. Offline

    worstboy32

    Dammm this plugin is great :D
    Only as Enis sayd clearing orbs when /nolagg clear would be cool :D.
    And it seems not rlly good to work with orbs.
    There are still about 1000 and not 40 on the floor.

    And what about the other file (spawn restrictions) can i paste it under the config?
     
  6. Offline

    bergerkiller

    @worstboy32 yup you can paste it under the config. Better to set restrictions for all mobs so you won't end up with 50 endermans (what had happened to me lol)

    And I'm now working on the exp. orb case.
     
  7. Offline

    worstboy32

    Oke! thnx for fast responding :D
    Cant wait for new update :p
     
  8. Offline

    bergerkiller

    I obviously want to make this fix automatic so you don't have to enter a command to get rid of the orbs. But for some reason the server freezes even if I set player experience to 5...

    Ridiculous!
     
  9. Offline

    worstboy32

    damm :S
    i hope u can fix it soon :D
    the orbs make tooo manny lag
     
  10. Offline

    bergerkiller

    @worstboy32 got it fixed. It will now set the player experience to 0 and spawn an orb containing the previous experience. Because the player exp is now 0, no orbs are spawned.

    Now checking the craftbukkit source code to check how and when orbs are spawned.
     
  11. Offline

    worstboy32

    maybe u can do something with this:
    works good for me just installed it.

    Download link:<Edit by Moderator: Redacted mediafire url>

    type /orbstatus to enter "orb cleansing mode". orb cleansing mode removes all exp orbs when ever an item is throw on to the floor. Please note that items appear from corpses BEFORE the exp orbs.

    type /remorb or /remorbs to remove all orbs if you don't want to use orb cleansing mode.
     
    Last edited by a moderator: Nov 12, 2016
  12. Offline

    bergerkiller

    @worstboy32 removing orbs is 0.01% the difficulty I am working with now. :)
    I already added removal this afternoon or so, and also it remains compatible with 1.73.
    Code:
        private void clear(World w) {
            for (Entity e : w.getEntities()) {
                if (e instanceof Item) {
                    e.remove();
                } else if (isOrb(e)) {
                    e.remove();
                }
            }
        }
    
        public static boolean isOrb(Entity e) {
            return e.getClass().getSimpleName().equals("CraftExperienceOrb");
        }
    It's a VERY bad idea to scan the world for orbs in the onItemSpawn event. If something bad happens (800 items spawn) the lag would be tremendous. I only loop entities once in every 20 ticks, plus allow admins to change this interval with it.

    I'll add a general routine to combine orbs together in one orb. I simply don't like removal as is, since Notch (and maybe other plugins) want to add more features to experience orbs. Removal is bad mkay. :)

    @in0de I am working on 1.11 which does fix it. I assumed the orbs were items, just like wood and others, but they were not. My bad, will update in a few minutes.

    EDIT

    Updated.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  13. Offline

    feildmaster

    I'm interested in what the orbScannerInterval actually does. (too lazy to look at source)
     
  14. Offline

    o0AzzA0o

    I have compiled a custom server jar which totaly disables the xp orb drops... no doubt ill get infraction for linking this but i feel that alot of people are on development build and need fix. Its build version 1149 and includes xp orb null from nerd bukkit.... hope this helps someone

    <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 12, 2016
  15. Offline

    bergerkiller

    @feildmaster It sets how long the interval in ticks is when this is executed for each world:
    Code:
        public static void combine(World world) {
            List<Entity> ee = world.getEntities();
            for (Entity e1 : ee) {
                if (valid(e1)) {
                    ExperienceOrb o1 = (ExperienceOrb) e1;
                    for (Entity e2 : ee) {
                        if (e2 != e1 && valid(e2)) {
                            ExperienceOrb o2 = (ExperienceOrb) e2;
                            //compare o1 and o2
                            if (o1.getLocation().distanceSquared(o2.getLocation()) < 4) {
                                o1.setExperience(o1.getExperience() + o2.getExperience());
                                o2.remove();
                            }
                        }
                    }
                }
            }
        }
    Also, I just detonated 9000 tnt without server/client lag and explosions everywhere...shit was so cash. (I will implement this in 1.12)
     
  16. Offline

    Fr0zenfr0g

    how long time will the chunks stay loaded if:
    chunkUnloadDelay: 10000?
     
  17. Offline

    bergerkiller

    @Fr0zenfr0g approx. 10 seconds. Time is in milliseconds there.

    BTW: my god controlled explosions are AWESOME! They last longer, the server doesn't freeze, explosions EVERYWHERE and it takes LONG. Damn I love this!

    EDIT

    This plugin is for 1.8 only for now. I will add better support for 1.73 tomorrow...it has some issues with the orbs (getExperience not defined) and an unexplainable lag source only occuring with 1.73. I'll see what I can do about it.
     
  18. Offline

    fffizzz

    any 80+ player servers running this? Curious as to how its working on large servers. I removed performancetweaks and its still running great. Does this do any delayed disk writes like that used to as well?
     
  19. Offline

    EmanuxJade

    very like, tyvm.
     
  20. Offline

    bergerkiller

    @fffizzz you can change the interval at which auto-saving takes place. It is set on the default value (40 ticks, 2 seconds) by default. The only player-affected things are death and movement. (movement only if the player location changed chunks)

    Now fixing lag-causing issues on 1.73 servers. Next version will have a pretty awesome delayed TNT detonation. It will have the same buffering, but instead of leaving lots of mobile TNTs around it will leave the actual blocks behind. Last test was very successful.
     
  21. Offline

    PlannedBoredom

    Does the config allow you to use just the tnt lag preventer? I like the tnt idea, but not the dropping items setting as much. So I want to limit the explosion tnt, as your video of 7000 tnt showed, but not the dropping blocks per chunk. I still want to be able to do the /nolag clear command though...
     
  22. Offline

    bergerkiller

    @PlannedBoredom set the max items per chunk to a very high value (for example 99999).

    I'll add an option to disable it by setting it to -1 (infinite)

    EDIT

    Updated, the new TNT system is a lot better so I recommend updating. See main page for the new usage.

    Also, I will probably make a new video since this one is pretty much outdated atm.
     
    PlannedBoredom likes this.
  23. Offline

    worstboy32

    Woow just updated it and it work great :D
    Thnx for your awesome plugin!
    Btw why the animated blocks will it not only make more lag?

    90 players and it work great :D
    no lagg :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  24. Offline

    bergerkiller

    @worstboy32 It's not the animated blocks (TNTprimed entities) causing lag, it is the main thread getting halted.

    Before NoLagg
    TnT explodes. Triggers other Tnts while destroying blocks. All explode. All trigger new Tnts. Etc. Eventually 1000 tnt's are being exploded in a single tick, requiring more than 20000 blocks to be changed, 1000 entity loops to get nearby entities to be damaged and lots of lighting updates. This all halts the server to a complete stop, physics fail.

    After Nolagg
    TnT explodes. Destroys the blocks and triggers nearby Tnts. Instead of emediately igniting the TnT, the block is pushed onto a 'todo ignitions' stack. A repeating task will detonate the tnt's one by one, leaving room for physics to take place. Each time a TnT is triggered by an explosion, it will be added to this stack for ignition later on.

    Note: NoLagg does not handle the regular ignitions, such as redstone, flint and steel and fire. Cannons will still work as required. Only thing that is handled are tnt-detonate-tnt events.

    Also, adding video of tnt demolition in 1.12. :) (this should be the default!)
     
  25. Offline

    Borch

    I just updated and still sometimes have the problem that no items drop when destroying a block in a chunk, although no items are lying around... Limit set to 45
     
  26. Offline

    bergerkiller

    @Borch What Craftbukkit build? Also, does reloading the server *temporarily* fix this issue (or permanently ofc)?
    Does setting this value to -1 work? An extremely high value?
     
  27. Offline

    jo3la

    Looks awesome, adding to my server!

    Thanks =)
     
  28. Offline

    Borch

    CB 1060. Restarting the server fixes the problem, last time there suddenly were a couple of cobblestone-stacks in one spot, the other time the items seemed to be gone (or maybe the stack appeared where we didn't see it), but drops seem to work again then. I now set the limit to 100, let's see what happens. The last time it happened I actually used X-Ray, filtered all blocks, and dug down from top to bottom, trying to find any items lying around anywhere, but no luck.

    Anyways, great job on the new TNT explosion system btw., works like a charm. :)
     
  29. Offline

    bergerkiller

    @Borch you can always use /nolagg clear to clear all items and orbs in the world you are in.

    EDIT

    Uploaded the explosion update video to give you all an idea. :)
     
  30. Offline

    Nolig

    Hey bro :) I will do a video in full HD . So i think i will upload today ....
     
  31. Offline

    bergerkiller

    @Nolig thanks, I appreciate it. Can't really get good results with a dual core 2.0 ghz cpu...lol
     

Share This Page