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


    @chiisana That's odd, it follows Bukkit guidelines when stacking (max size), so if it's not possible outside this plugin then that's more of a bug in Bukkit...

    @Flatliner believe me, it has...3 new classes, around 500 lines long, reworked code mostly. NoLaggChunks be gone :)

    Updating to 1.51....
  3. Some times console show me this i dont know it is a problem or no XD.

    2011-12-04 01:43:45 [INFOvicente947 [/ in with entity id 460 at ([liso454.19600674128978.0, -405.6881027519126)
    2011-12-04 01:43:46 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [29/-24]]
    2011-12-04 01:43:46 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [28/-24]]
    2011-12-04 01:43:46 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [27/-24]]
    2011-12-04 01:43:50 [INFO] [xAuthvicente947 has logged in
    -12-04 01:43:50 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [9/-4]]
    2011-12-04 01:43:50 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [4/-9]]
    2011-12-04 01:43:50 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [4/-8]]
    2011-12-04 01:43:50 [WARNING] [NoLagg] [ChunksPacket out of reach of 'vicente947': [MapChunk 51uncompressed Chunk: [4/-7]]
    2011-12-04 01:43:58 [INFOisraelx1 [/ in with entity id 3323 at ([liso479.571350775429286.43859317727993, -399.1017119509999)
  4. Offline


    Pretty sure that's no biggie, just means a chunk was sent that a player couldn't see (if I remember right)
  5. Any can send me a good config of Nolaggchunks for works good with Chunkmanager?
  6. Offline


    @vicente947 don't use NoLaggChunks for now, importing my own version in NoLagg.
  7. Offline


    Any ETA on when we could try out a build?
  8. Offline


    @rtcabooservb now uploading 1.51 :)

    Updated to v1.51, changes:
    - Fixed Sign text not getting received
    - No longer needed to have Spout (NoLaggChunks is now gone and inside NoLagg)
    - Improved sending algorithms and coding to use less CPU
    - Chunks will be sent quicker in general
  9. Offline


    Sweetness, dropping this in my server now for my guinea pigs to test overnight :)
  10. Offline


    Lol this is awesome in combination with TrainCarts...having a train go at 9 blocks/tick while chunks are still visible around you...damn :D
  11. Offline


    runnin great right now.. 51 connected averate TPS 18, no chunk problems.

    still running spout for vanishnopacket..

    22:11:34 [INFO] Memory: 2877/6566 MB (+0 modified)(+-10 MB/s)
    22:11:34 [INFO] Chunks: 14383 [6883 Buffered] [+21] [-8] [5109 left to save]
    22:11:34 [INFO] Entities: 3131 [2459 mobs] [449 items] [0 mobile TNT]
    22:11:34 [INFO] Buffers: [0 TNT] [4 items]
    22:11:34 [INFO] Ticks per second: 19.5 [97.0%]
  12. Offline


    Woo +10000 IQ points to you. Now to test it.
  13. Offline


    So I tried the /nolagg monitor command and saw this:


    It says that it is using 359/630mb (GC) but I have 3GB assigned in the start.bat file. Sometimes I have some lagg so I think I need to set the 3GB value somewhere else so that the server has a oppurtunity to use 3000mb memory if needed, instead of a max. of 630mb.

    Has someone a idea where I can change these numbers?
  14. Offline


    Everything is fine. It just shows 630 because you don't need anymore Ram. When the server needs more ram this number will increase by itself. Go fly around and load up some chunks and you'll see.
  15. Offline


    I'm guessing you have Xmx assigned to 3G, but Xms either unset, or set at a much lower value. Your server will start initially with only Xms value, and expand more as needed. This typically happens only when you have more concurrent connections (ie: more players online at the same time) AND are in different regions (players clustered together will not require too much more RAM as most RAM is consumed by loading chunks around players into memory).

    Laggs usually comes from several things:
    CPU -- main control thread doing too many things, and cannot keep up. You'll notice the Ticks per second fell below 20 if that is the case. Try to disable a few plugins, and see if that helps. Things that require a lot of resources, such as map rendering, are usually the trouble makers.

    Disk IO -- a lot of players are in game, they're in different regions (32 chunk x 32 chunk size), which requires a lot of regular disk write. This slow down can be resolved by using SSD or RAM Disk. If you elect to use RAM Disk, be sure to take regular backups as data on RAM Disk will be lost forever if there is a power outage, or unexpected shutdown.

    Network lag -- Too many people online and the server's internet connection cannot keep up. This sucks, and there is no way around this as far as I'm aware of.

    RAM, actually, from my limited experience, doesn't really come in play that much... But if you feel that it is the case, try setting your Xms parameter higher than what it is now, and make sure you actually have sufficient RAM available.
  16. Offline


    New generated chunks, mainly mountains, suffer from plenty lighting bugs....
    Mb it's a vanilla-bug, but could you try to fix this?
    Using /nolagg fix will remove them..

    Edit: autoFixLighting is already enabled
  17. Offline


    @chiisana I do get around network lag by maintaining the chunk send rate. I considered having some sort of 'weightened setting', to set the maximum allowed chunks per tick globally. But for now you'll have to do with player-specific unweighed send interval and rate.

    @Sepulzera No way, so this lighting bug isn't fixed in 1.00?!
    Ow well, could be that area was already explored before but not yet fixed from lighting issues. Does it still show lighting issues when exploring new areas?
  18. Offline


    Ok checked it now.
    Seems to occur mainly in cliffs and but vanilla either.
  19. Offline


    Great plugin, an absolute must for my upcoming server!
  20. Offline


    It gets better: today implemented 'weightened sending'. This means that, for players low on chunks, more chunks are sent than for player with a lot of chunks around him. This ensures that the network capacity (max chunks per tick globally) is not exceeded. Interval and rate will be replaced by:
    The first test run was amazing :D
    Zathras likes this.
  21. Offline


    Aight, so I'm planning to update in a couple of hours, so a general question about the send limiting: What would be recommended settings for a server with 50MBit up+down? Having around 30 players max., does it even matter then? Running vnstat I barely see more than 20MBit upload. Will it still help in some way?
  22. Offline


    @Borch I will update it to use the new weightening soon, so I'll just explain that.

    A chunk takes up an estimate of 10 kb. 1 tick per second equals 200 kb/s on average. Having a 'chunks per tick' of 2 will result in 400 kb/s. It depends on your connection and CPU how well you can handle chunk packets, so the maximum tick rate globally can be set depending on that.

    There is also a 'player max chunks per tick'. This is used to keep the rate steady so players don't get overflow issues with the large amount of chunks. The default is at 0.25 at this point.

    Successfully tested with a global rate of 2 and player rate of 0.25, works great. Expect an update in a few minutes.


    Also, if you are the only one on a server, your send rate will probably equal the 'maxChunksPerPlayerPerTick' setting, since there is only one queue to check against. The more players, the slower sending will become, but it depends on your sending rate settings.
    Nathan C likes this.
  23. Offline


    I guess the same applies if everyone is standing still and I'm the only one moving. That would be quite a nice feature then :)
    So using a global send rate of 2 chunks per tick at 20TPS, I would have a theoretical maximum upload of ~400kb/s? (plus what ever else is sent, movement, entities, chat, but that's not too much compared to chunk data I guess)
    Based on these estimates, I could set the global rate to 20 chunks per tick with my connection and would still have enough upload left for all the other data. Planning to do so, and set the per-player-rate to 2 then.
    About the CPU usage, isn't chunk compression on its own thread anyways? Having 4 cores, so I think that shouldn't be an issue then.
  24. Offline


    @Borch well actually I had a conversation with Thulinma, he explained that having a global chunk rate was a bit pointless. Having a server go at 10mbit estimated, this is 1225 kbyte/sec, which would hold 122 chunk packets/sec (6 chunks/tick) on average. I doubt a server with 10mbit will ever run more than 6 players anyway, so I got rid of the global rate cap.
    Instead there is a minRate and maxRate in chunks/tick for every player, you can change this to improve connection. Minrate is active at far-away chunks, maxrate at near chunks, which are balanced out.

    Want to boost player cap? Set the min rate lower and/or the max rate lower. Default min/max are 0.25/2.00.

    updating... *updated*
  25. Offline


    Much appreciated :p
  26. Offline


    Can I use it in Minecraft 1.0 with WorldEDIT or it will lagg ?
  27. Offline


    @jamesst20 Worldedit only causes lag if you do a tremendous amount of chunk changes, for example, changing a huge area to dirt. Nothing I can do against this (tick) lag.
  28. Offline



    for a system thats using ramdiscs is there much advantange to using chunk buffer option? ie chunkunloaddelay
  29. Offline


    @o0AzzA0o Chunk unload delays don't reduce RAM usage, the opposite is true, it increases it. The purpose of unload delays is to allow async chunk saving when chunks are unloaded and to keep commonly visited chunks loaded longer, reducing disk IO en CPU usage caused by compression.

    Having a RAM disk will get rid of the disk usage as well, but chunk unload can still cause a tick rate drop when a lot of chunks are getting unloaded. For a very good cpu this can be neglected, then you are free to disable it.

    tldr; Chunk unload delays reduce CPU usage and disk IO usage, if you have an incredibly good CPU and use a RAM disk, this reduction is very small, making the need for it to be enabled lower.
    Nathan C and o0AzzA0o like this.
  30. Offline


    Confirmed, it really works :) No lagg since I use NoLagg and I was having some with Ptweaks.

    Awesome works Thanks !

    I even tested with 180 000 TnT and No Lag + No deconnection ! :D

    Nice work !
  31. Offline


    A little update to 1.52.1, a bug left unnoticed a very long time. It was unloading chunks without consulting other plugins, resulting in TrainCarts (in my case) not being able to control chunk loads. This is now fixed. You won't notice much, but maybe other plugins will no longer show a certain bug.

Share This Page