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

    sweet_lemonade2

    I recently installed iconomy and mcjobs, to have an economy for the showcase plugin. every minute theres a slight lag jolt here and there. The terminal for the server says "Can't keep up. did the system time change?" every 3 seconds.

    Well hopefully it won't be a problem for too much longer I'm due to upgrade my computer in a months time to an i7 with more RAM, I've read around and apparantly the better the CPU the better the performance and the RAM helps as well.
    But thats what I've 'heard'.
    Thanks for the advice though I suppose I'll wait untill I get my new computer then try this stuff out.
     
  3. Offline

    Borch

    A few MC versions ago, I really liked to use the unload delay and async saving. It seemed to improve things on my server. Now for some time you recommend not to use it as it might cause problems.
    My questions are:
    What are those expected problems?
    I remember rumors that Minecraft itself now saves chunks asynchronously. Is that true?
     
  4. Offline

    bergerkiller

    Borch yep. A while ago, async saving wasn't in, so I implemented this myself in NoLagg. After it got added internally, I removed it and only kept the save interval changing, although that isn't really needed either. There is only one problem with the current saving: it doesn't write to disk instantly. So if the server crashes, even after saving everything, you can still lose your changes.

    Problems with NoLagg are related to the routinely update. It has to loop through all chunks of all worlds, and also through all entities. When a lot of chunks/entities are loaded, it has to spend a lot of time doing this, which causes a lot of lag. (every 'update interval'). Because of this, I separated the components so this wouldn't tear down performance all the time.

    Chunk unload delays require me to check, for every chunk, if players are nearby, and if the time before unloading has passed. For a lot of chunks this is simply too slow, although I tried to make all operations as fast as possible.
     
  5. Offline

    monir

    I cant find any other plugins can you please give me a tip?
     
  6. Offline

    dabomb665m

    Hi bergerkiller. I haven't tested the nolagg chunks with different settings yet as you have mentioned... I'm thinking of going ahead and giving it another shot. However, do you know if this chunk fix is compatible with cb+spoutplugin+spout? I understand spout plugin handles its own chunk/caching for recognized spout clients. Is this going to help the spout clients as well? would they interfere? I'm willing to go through the trouble of tweaking it if it should work together.
     
  7. Offline

    bergerkiller

    dabomb665m NoLaggChunks no longer caches chunks, it is too dangerous and caused world corruption. All it does right now is handle chunk PACKET creation and sending in an optimized manner. It is compatible AFAIK and will help yes, as Spout doesn't use a 'real' good sending algorithm (spiral) and neither do they adapt the rate to the client connection.

    monir There is EntitySupressor which does this quite well.
     
  8. Offline

    dabomb665m

    Ok... is there any more information on how the settings should be set or how it is supposed to affect your server's packet sending? I'm using a roughly 1mb upload connection but since you last gave me advice, the server's player base has changed drastically.

    I have some "local" usa players that do fine... and quite a bit of asian players that play during my night hours that will experience anywhere from a little bit of lag to pretty severe.

    When I last used the nolagg chunks, my low ping users felt jerky, while my high ping over seas players felt even more laggy than usual (skipping etc).

    In what way/direction should I be tweaking the min/max send with this peculiar situation? Should I find out what a comfortable "min" for my low ping users and then slowly adjust the max down for the high pings? Or do I have it completely backwards? heh. Please advise!
     
  9. Offline

    bergerkiller

    dabomb665m It is pretty complicated, but I feel that the plugin fails to find a suitable min/max rate. Can you define 'jerky'? Is it related to player movement, how well are chunks received, do they have chat lag, etc. If possible, let them use the '/lag sending' command to show them their current sending stats, and check what % their packet buffer is loaded. If it is too high, this can explain chat lag and lagged movement and the rate needs to be lower. Then verify what their current sending rate is. If this is higher than the minimum, then there is obviously a miscalculation going on.
     
  10. Offline

    Borch

    bergerkiller Aight, thanks for the clarification.
    Another question: I have lots of lighting erros in an existing world, if I run something like /nolagg fix 1000, will it load chunks that are not in range currently, or will it just handle as many chunks as there are loaded around the player?
     
  11. Offline

    bergerkiller

    Borch it will load all chunks out of reach too, so be careful with it...
     
  12. Offline

    Borch

    Hmm, it doesn't seem to work properly in all cases. I'm using it in the nether, and there is at least one spot where a 1x1 lava pile actually gets dark spots if I to /nolagg fix 2 near it. The light will then slowly correct itself again until the whole pile is bright again ,but if I then move away from that chunk so it unloads and then move back to it, it will be dark again.
    In the screenshot you see what it looks like after doing 'fix'. Before I ran the command it looked normal.
    2012-04-24_23.14.45.png
     
  13. Offline

    bergerkiller

    Borch block lighting is not fixed in 1.82, as it took too long to perform it. (and gave a lot of failure warnings...)

    New version hopefully fixes this, but I need to combine all components first. Takes time...
     
  14. Offline

    Giuseppe

    i have no idea i right here
    2012-04-30 22:13:52 [INFO] WorldEdit: Giuseppe1990 (in "neu"): /regen - Region: (442.0, 63.0, 147.0) - (454.0, 63.0, 160.0)
    2012-04-30 22:13:55 [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
    2012-04-30 22:13:55 [WARNING] Failed to handle packet: java.lang.ClassCastException: org.bukkit.craftbukkit.CraftChunk cannot be cast to org.getspout.spoutapi.block.SpoutChunk
    java.lang.ClassCastException: org.bukkit.craftbukkit.CraftChunk cannot be cast to org.getspout.spoutapi.block.SpoutChunk
    at org.getspout.spoutapi.packet.PacketCustomBlockChunkOverride.run(PacketCustomBlockChunkOverride.java:81)
    at org.getspout.spout.packet.CustomPacket.handle(CustomPacket.java:138)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
    at org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:169)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:551)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:449)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    2012-04-30 22:13:55 [INFO] Giuseppe1990 lost connection: user was kicked.
     
  15. Offline

    bergerkiller

    Giuseppe is this related to NoLagg at all? *confused*
     
  16. Offline

    Giuseppe

    i have no idea sry
     
  17. Offline

    SilencShadoW

    Hey Berger, can u PN me your Hamachi again, i dont find the address and want to speak about something ... :)
     
  18. Offline

    bergerkiller

    Currently further working on this plugin. I noticed that the use of multiple jar files conflicted with the class loader of Bukkit, so I am reverting it. All components are now in one jar file again, all permissions are in one yml file and all configuration is in one jar file. I made a simple engine to run all the plugins on, which simulate multiple plugins.

    Now working on fixing/removing the less-recommended features 'Chunk unload delay' and 'Spawn limiter'. I honestly don't think it is a good idea to keep the spawn limiter in there, as it, simply put, causes more lag than it prevents. I will probably change it to use the creature spawn event and only that, as that is the only way to cancel spawns without lag. (although the event could be spammed as a result)
     
  19. Offline

    bergerkiller

    Updated to v1.83. All components are in one Jar file again, complete with a shared config.yml file. The changelog is quite a lot...mostly bugfixes and performance changes, so not sure if I can name them all. Few noticeable things are that the chunk unload delay is gone, the examine viewer is improved, the spawn limiter is fixed and improved, item buffer had some error fixes, lighting fixer fixes block lighting now, thread check is now loaded at all times to help spotting bugs, permissions are all in one yml file same for configuration and the saving component is added. The saving component can as well 'flush' the world data to the file system. This is not to prevent lag, but to prevent you losing a lot of progress if the server crashes.
     
  20. Offline

    XRELO4DZXx

    WHERE IS THE DOWNLOAD!!!!!!!!!!!!!!!!!!
     
  21. Offline

    bergerkiller

  22. Offline

    Adrenaline

  23. Offline

    Luk

    Hey, I have some issues with this plugin.

    Do I miss something, or why is item-drop being disabled after ~ 30 Minutes? Either /reload and restarting the Server completely fix this issue.
     
  24. Offline

    bergerkiller

    Luk disable the spawn limiter or maybe item buffer, it is possible that ether of them are bugging you. (I kind of expect the spawn limiter to be to blame)
     
  25. Offline

    shanko

    Dang I really liked being able to leave some parts of the plugin out completely, how does it conflict with bukkit?
     
  26. Offline

    bergerkiller

    shanko and you can, see config.yml. Parts that are not enabled are not even loaded as class. All components are still hermetically sealed, but now with the benefit of it all being loaded under one plugin to prevent cross-classloader trouble.
     
  27. Having same issue as Luk
     
  28. What is bkcommonlib for? Like mentioned before. Drops stopped after a short time and disabling "bkcommonlib" fixed this. I didn't know what plugin caused the drops to stop at the time so I disabled them one at a time. So after I found out it worked after disabling this, that's when I looked up that it came with nolagg.
     
  29. Offline

    bergerkiller

    Sketaful All of my plugins won't even function without it enabled, so obviously if you remove BKCommonLib all other plugins of mine stop enabling.

    The bug you and others mentioned was in the spawn limiter and item buffer components. It didn't detect item removal (which I had to fix in BKCommonlib yes). Did some thorough tests and all are working now. (arrow limit of 10: can shoot 10 arrows and then no more. Have to pick up arrows to continue shooting another batch of 10)

    BKCommonLib is basically an utility library with all sorts of common functions all of my plugins utilize. It's main purpose is proving a plugin base I can extend, which automatically handles commands, dependency detection and unloading, configuration, permission defaults and other handy functions. It also has a LOT of logic and math functions, from getting the squared length to obtaining the name of an entity. The goal of this library is to have all utilities in one place so I don't end up with the same functions cloned in all of my plugins. That would only be a waste of memory and loading times.
     
    Sketaful likes this.
  30. Offline

    GrillGuth

    bergerkiller: I have huge lagg-issues. Looks like your "CreatureSpawnEvent" is causing them?
    Here is an exam-file: Link
    Would be nice if you can help me :)

    Here is my config.yml:
    Code:
    # This is the configuration of NoLagg, in here you can enable or disable features as you please
    # For more information, you can visit the following websites:
    # http://dev.bukkit.org/server-mods/nolagg/
    # http://forums.bukkit.org/threads/nolagg.36986/
     
    # Manages chunk loading and sending to clients using various new settings
    chunks:
      # Whether Chunks should be loaded on startup
      enabled: false
      minRate: 0.25
      maxRate: 2.0
      triggerRate: 0.5
      bufferedLoader:
        enabled: true
        threadCount: 2
     
    # Can examine server tick rate performance
    examine:
      # Whether Examine should be loaded on startup
      enabled: true
     
    # Can monitor and log server and player performance statistics
    monitor:
      # Whether Monitor should be loaded on startup
      enabled: true
      # The interval at which new performance snapshots are generated
      monitorInterval: 40
      # Whether or not to start logging server performance on startup
      startLoggingOnStartup: false
     
      # The server notifies players (with a permission) when the tick rate drops below the threshold
      lagNotifier:
        # Enable or disable this feature
        enabled: false
        # The interval in miliseconds to send this message (1000 ms = 1 second)
        interval: 10000
        # The tick rate at which it starts broadcasting
        threshold: 15.0
        # The message to send to these players
        message: '&cThe server can''t keep up!'
     
    # Buffers items in chunks to prevent lag-outs because of lots of items
    itembuffer:
      # Whether ItemBuffer should be loaded on startup
      enabled: true
      # The maximum amount of items allowed per chunk
      maxItemsPerChunk: 40
     
    # Stacks nearby items to counter item-drop spammers and reduce item count on the server
    itemstacker:
      # Whether ItemStacker should be loaded on startup
      enabled: true
      # The block radius to look for other items when stacking
      # You can set it for multiple worlds
      radius:
        default: 1.0
      # The amount of (physical) items needed to form one stack
      threshold: 2
      # The interval in ticks at which item stacking is performed (1 tick = 1/20 sec)
      interval: 20
     
      # The item types (materials) to ignore during item stacking, buffering and spawn limits
      # Use 'orb' to ignore experience orbs
      ignoredItemTypes:
      - DIAMOND_PICKAXE
      - WOODEN_HOE
     
    # Attempts to fix block and sky lighting bugs in worlds
    lighting:
      # Whether Lighting should be loaded on startup
      enabled: true
      # Whether or not lighting is automatically fixed when a new chunk is generated
      auto: true
     
    # Keeps entity counts below multiple configured thresholds
    spawnlimiter:
      # Whether SpawnLimiter should be loaded on startup
      enabled: true
     
      # The general spawn limits (natural spawning)
      # For more information, see http://dev.bukkit.org/server-mods/nolagg/pages/spawn-limits-nolagg/
      spawnlimits:
        # The global spawn limits
        global:
          mobs: 3000
          squid: 100
        # The default spawn limits per world, overridden by world limits
        default: {}
        # The world-specific spawn limits
        worlds: {}
     
      # The spawn limits for mob spawners
      # For more information, see http://dev.bukkit.org/server-mods/nolagg/pages/spawn-limits-nolagg/
      mobSpawnerLimits:
        # The global spawn limits
        global:
          mob: 1500
        # The default spawn limits per world, overridden by world limits
        default: {}
        # The world-specific spawn limits
        worlds: {}
    # This is the configuration of NoLaggTNT
     
    tnt:
      # Whether TNT should be loaded on startup
      enabled: true
      # The interval (in ticks) at which TNT is detonated by explosions
      detonationInterval: 1
      # How many TNT is detonated by explosions per interval
      detonationRate: 10
      # The explosion crater size factor
      explosionRadiusFactor: 1.0
      # The amount of explosion packets to send to the clients per tick
      explosionRate: 5
      # If TNT explosions can change non-TNT blocks
      changeBlocks: true
     
    # Alters the way worlds are saved to reduce disk usage and to force proper saves
    saving:
      # Whether Saving should be loaded on startup
      enabled: true
      # The tick interval at which the server saves automatically (20 ticks = 1 second)
      autoSaveInterval: 500
      # Whether NoLagg will attempt to write all world data to the region files at a set interval
      # This is done on another thread, so don't worry about the main thread lagging while this happens
      writeDataEnabled: true
      # The tick interval at which the server actually writes the chunk data to file (20 ticks = 1 second)
      writeDataInterval: 12000
     
    # Common features such as the clear and garbage collect commands
    common:
      # Whether Common should be loaded on startup
      enabled: true
     
      # Several shortcuts you can use for the /nolagg clear(all) command
      clearShortcuts:
        enemies:
        - monster
        notneutral:
        - monster
        - item
        - tnt
        - egg
        - arrow
     
    
    Greetings,
    GrillGuth
     
  31. Offline

    bergerkiller

    GrillGuth check if disabling the spawn limiter fixes that problem for you.

    EDIT

    Wut a full second to process one tick of spawning? Weird...could be a random happening due to Java's inner workings. TBH it doesn't look too bad, only that strange spike that happens once.
     

Share This Page