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

    Afforess

    Register event lets you use static classes? :confused:, I learned something new.

    As for why, the reason would be that interfaces can't force a class to use the empty constructor (why Java, why!) so I'd just be trying to use class.newInstance(), which could throw an exception at me.

    Compare that to using (new Listener()), which can't throw an exception, at least not during construction in Spout code.
     
  3. Offline

    bergerkiller

    @Afforess no they don't, that's the point. This section of lines is present in every single plugin...and it is pretty useless IMO.
    Code:
        private final NLPlayerListener playerListener = new NLPlayerListener();
        private final NLEntityListener entityListener = new NLEntityListener();
        private final NLWorldListener worldListener = new NLWorldListener();
        private final NLPacketListener packetListener = new NLPacketListener();
    And why would you need to construct it? Can't you use this?:
    Code:
            Class c = NLPlayerListener.class;
            Method move = c.getMethod("onPlayerMove", PlayerMoveEvent.class);
    
            PlayerMoveEvent event = new PlayerMoveEvent();
            move.invoke(null, event);
            if (event.isCancelled()) {
    
            }
    I know, it looks gibberish, but in theory it should be possible to access static members and use them as listener classes..
     
  4. Offline

    Afforess

    Reflection would be slower than the current way of doing it.
     
  5. Offline

    Massimo1993

    @bergerkiller
    i don't now why with your plugin the cunck won't load: i've a lot of hole in my server and the only whay to restore is remove you plugin. im need to set sometingh or your plugin don't work?
     
  6. Offline

    bergerkiller

    @Massimo1993 set unloadChunkDelay to 0 and the sendCHunkInterval to -1. For now, keep these two features disabled. Note that you can load chunks by clicking the 'void'.

    That worked nicely! Finally Spout has a use in one of my plugins. :D
    What I do:
    - handle world packets being sent
    - put them in a custom chunk|packet hashmap implementation
    - Use my own chunk sending algorithm on the hashmap
    - Success. :)

    Now to check for possible black holes, nothing noticed yet. Benefit is that, right now, only those chunks are sent that the player actually sees. :)

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

    Massimo1993

  8. Offline

    bergerkiller

    You can set chunk sending intervals and rates. It basically send chunks to the player in a different order. Where chunks behind you were loaded previously, now chunks ahead of you are loaded first. This means you no longer end up walking into a black hole while chunks around you are still loading.

    One issue I'm having till release:
    @Afforess I need your help here. The native Packet51MapChunk class has uncompressed data (rawData) and compressed data (h). Now, when I try to handle the packets myself, the g byte array is empty, null. In other words: the rawData does not get compressed. What do I need to store and call to send a packet (MCPacket) delayed?

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

    Kane

    @bergerkiller How would this benefit my server if I choose not to use the say item dropping feature and well I know how the tnt will benefit but for a large active server what here would really help the performance of the server its self?

    Thanks!
     
  10. Offline

    bergerkiller

    @Kane If you disable features you obviously add less performance improvements. :)
    It's mostly for servers that can't handle too much, for example, the new 1.8 increased the amount of spawned mobs on every world, causing lag. Using spawnlimits you can fix that. Other than that, changing the saveinterval or unloaddelay reduces disk usage.

    I'd love to implement my custom chunk algorithm, which truly reduces network usage, but unfortunately some chunks are acting weird...the package doesn't seem to reach the client.
     
  11. Offline

    Kane

    Yeah the saveinterval might be useful I can see to stop hitting the disk as much or unloaddelay maybe a bit too. I worry about things like spawnlimit of items where people might abuse the system by creating even larger farms for says cactus hehe.

    Not worried about bandwidth or network traffic in anyway. Just trying find better ways to reduce lag when comes to server performance. We only have 2 worlds with mob spawns and our main world has them disabled.
     
  12. Offline

    bergerkiller

    Good news: I finally managed to get it to work properly. I threw the idea of using the Spout returned packets away, since that failed badly. The entire world was littered with holes. Instead, I will make these packets invalidate a chunk for the player, where my updater takes it over. It works without Spout too, but probably not as good. :)
     
  13. Offline

    Afforess

  14. Offline

    bergerkiller

    @Afforess I know, I tried all of them. Problem is that, with either of the two, the compressed data is not (yet) made. I then try to send this packet delayed, through the SpoutPlayer or netserverhandler, and at that point all the packets lost the compressed data. It works for around 6x6 chunks, but then it stops loading chunks all together.

    Also, updated to v1.21. It does have Spout support: it cancels entire chunks and clears this chunk in the player sent chunks grid. In short: invalidates the chunk at that player and a scheduler sends the chunk.
     
  15. Offline

    Fr0zenfr0g

    is the problem from 1.2 with blackholes and monsters fails fixed in 1.21?
     
  16. Offline

    bergerkiller

    @Fr0zenfr0g I haven't seen holes since, so I hope so. If you still see some and you don't use Spout, add Spout as plugin and see if you see any changes.
     
  17. Offline

    Th3Controller

    Neat! Looking for something like this all the time!

    Use BananaChunk, this prevents or minimizes lag holes. If your stuck in a lag hole just type /chunkme with BananaChunk.

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

    bergerkiller

    @Th3Controller this plugin also has this feature: you only need to aim at the chunk to load (below you) and left-click. It should also minimize the chance of ending up in a hole, since it sends the chunk the player is in when the player changes chunks.
     
  19. Offline

    Hydrosis

    [SEVERE] Could not load 'plugins\NoLagg.jar' in folder 'plugins':
    java.lang.NoClassDefFoundError: org/getspout/spoutapi/packet/listener/PacketListener
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:168)
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:215)
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:139)
    at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:104)
    at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:101)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:136)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:348)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
    Caused by: java.lang.ClassNotFoundException: org.getspout.spoutapi.packet.listener.PacketListener
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:36)
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:24)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 11 more
     
  20. Offline

    bergerkiller

    Yup, I just noticed Java complains when you implement a class from an optional plugin. Till I come up with a separate add-on for NoLagg with the chunk loading features, download Spout and place it in the plugins.

    @SpoutDev or @Afforess is it possible to implement a Spout listener without requiring a fixed reference to Spout?
     
  21. Offline

    Afforess

    @lishid had the same problem with the OreObfuscater. The only solution is to make a "Spout" bridge plugin that acts as an intermediary between the two if you want it to be optional. You could include the bridge jar inside of the main jar, check for spout and write it the the plugins directory and enable it.
     
  22. Offline

    spunkiie

    @bergerkiller

    Is that possible to DISABLE all other NoLagg features and use ONLY the chunksendrate/chunksendinterval ones ?

    I have a 500+ server, think it will help us alot.
     
  23. Offline

    Th3Controller

    I'm really scared of installing this but I'm all about performance and speed and I'm scared of setting it up. Can you please help me? The config file scares me. So much numbers!
     
  24. Offline

    ewized

    I think you should make spout required because spout helps with the performance tweets. All in all its what the plugin was meant for stopping lag.
     
  25. Offline

    QQCucumber

    Here, have an error. Wasn't doing anything special. Using the recent RB of Spout and the latest NoLagg

    Code:
    2011-09-30 08:17:51 [SEVERE] Could not pass event PLAYER_MOVE to NoLagg
    java.util.ConcurrentModificationException
    	at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
    	at java.util.HashMap$KeyIterator.next(Unknown Source)
    	at java.util.AbstractCollection.toArray(Unknown Source)
    	at com.bergerkiller.bukkit.nolagg.PlayerChunkLoader.updateChunk(PlayerChunkLoader.java:199)
    	at com.bergerkiller.bukkit.nolagg.PlayerChunkLoader.update(PlayerChunkLoader.java:83)
    	at com.bergerkiller.bukkit.nolagg.ChunkHandler.handleMove(ChunkHandler.java:49)
    	at com.bergerkiller.bukkit.nolagg.NLPlayerListener.onPlayerMove(NLPlayerListener.java:32)
    	at org.bukkit.plugin.java.JavaPluginLoader$7.execute(JavaPluginLoader.java:286)
    	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:339)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:180)
    	at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:618)
    	at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    	at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    	at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
    	at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:500)
    	at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    	at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:471)
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    	at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
     
    Zathras likes this.
  26. Offline

    dockter

    There is a big bug in this plugin, not sure if its a conflict with Spout but all my text is starting to disappear on signs.

    I remove this plugin, the text comes back. I put in back in, texts start to randomly disappear. Very Odd.
     
  27. Offline

    CyrussM

    Yeah this is what i need. We dont want a real limit (or buffer), but remove the arrows after a while will help a lot.
     
  28. Offline

    ledhead900

    Holy Cow you managed to get a method for chunks to not be sent if u cannot visibly seem them, that has to save CPU and bandwidth on servers right ?. What still to this day blows my mind is thinking up a reason as to why Notch simply has not gotten talented coders like Spout team and You and Dinnerbone to write up a new method of handling chunk data and lag things like this plugin does so he could use it permanently in the normal client.

    Tho this is Notch and well nuff said, anyway great work this plugin just gets better every version.


    Edit:
    I do however have a question can you maybe write up a list of all possible entity names we can use I always have trouble knowing what format to type them, some plugins don't care about case some format them exactly how they are in code etc.
     
  29. Offline

    TelephoneKiosk

    I keep getting this error:
    2011-09-30 01:06:59 [SEVERE] Could not pass event PLAYER_MOVE to NoLagg
    java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
    at java.util.HashMap$KeyIterator.next(Unknown Source)
    at java.util.AbstractCollection.toArray(Unknown Source)
    at com.bergerkiller.bukkit.nolagg.PlayerChunkLoader.updateChunk(PlayerChunkLoader.java:199)
    at com.bergerkiller.bukkit.nolagg.PlayerChunkLoader.update(PlayerChunkLoader.java:83)
    at com.bergerkiller.bukkit.nolagg.ChunkHandler.handleMove(ChunkHandler.java:49)
    at com.bergerkiller.bukkit.nolagg.NLPlayerListener.onPlayerMove(NLPlayerListener.java:32)
    at org.bukkit.plugin.java.JavaPluginLoader$7.execute(JavaPluginLoader.java:286)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:338)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:180)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:618)
    at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:226)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:92)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:500)
    at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:464)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
     
  30. Offline

    Eminam

    Same problem here I've been running around going OMG WTF LOL hahaha
     
    externo6 likes this.
  31. Offline

    rbos

    The memory leak is gone as of 1.20, which is awesome, and I like the plugin a lot.

    However I've gotten a couple reports of items duping on death, which may or may not be this plugin. Keep it in mind maybe. I've installed 1.21 just now.
     

Share This Page