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


    @Kane this one is a good base, simply lower the defaultplayerinterval until you are happy with it. Right now it sends one chunk ever 10 ticks; around 2 chunks per second.
    defaultPlayerDownloadSize: 10
    globalSendMaxRate: 2
    defaultPlayerSendInterval: 10
    globalSendInterval: 1
    defaultPlayerSendRate: 1
    Also: known issues I am currently solving:
    - At rare occasions the world is not sent to the client, he needs to rejoin
    - When reloading the chunk buffer is cleared, thus chunks are not sent. Huge gaps are the result.
  3. Offline


    Done. however still have the same problem.. I'm only getting a few pigs spawning. But nothing else. Cann't i just disabled the option to limit mobs in this plugin????If i can how do i do that?
  4. Offline


    well, I tried it again and got this: (Though it did seem to fix lag!)

    [SEVERE] Could not pass event PLAYER_PICKUP_ITEM to NoLagg
    java.lang.NoSuchMethodError: org.bukkit.entity.Item.getPickupDelay()I
    at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    at com.bergerkiller.bukkit.nolagg.ItemHandler.respawnItem(
    at com.bergerkiller.bukkit.nolagg.ItemHandler.spawnHiddenItem(
    at com.bergerkiller.bukkit.nolagg.ItemHandler.spawnInChunk(
    at com.bergerkiller.bukkit.nolagg.ItemHandler.removeSpawnedItem(
    at com.bergerkiller.bukkit.nolagg.NLPlayerListener.onPlayerPickupItem(
    at org.bukkit.plugin.RegisteredListener.callEvent(
    at org.bukkit.plugin.SimplePluginManager.callEvent(
    at net.minecraft.server.EntityItem.a_(
    at net.minecraft.server.EntityHuman.j(
    at net.minecraft.server.EntityHuman.s(
    at net.minecraft.server.EntityLiving.s_(
    at net.minecraft.server.EntityHuman.s_(
    at net.minecraft.server.EntityPlayer.b(
    at net.minecraft.server.NetServerHandler.a(
    at net.minecraft.server.Packet10Flying.a(SourceFile:126)
    at net.minecraft.server.NetworkManager.b(
    at net.minecraft.server.NetServerHandler.a(
    at net.minecraft.server.NetworkListenThread.a(SourceFile:108)
    at net.minecraft.server.MinecraftServer.h(
    Could this be becuse we're still on the 1185?
  5. Offline


    @kawiz yup, btw 1240 is ALOT better than 1185, do update since they fixed a lot of bugs.

    @ray0911 See the main page, added enable/disable properties in 1.28. Also, the 1185 version has issues with the spawn limiters, I recommend updating it CB instead...

    Ok guys expect an AWESOME chunks add-on update you'll love!

    You can set everything, global, default and player-specific:
    With this add-on you can basically stop the lag when players join or move a lot. It will make sure your connection is optimally used, and not littered with packets the players don't need!

    Now doing some testing. I have seen no issues on my local server, but it's best to check it for a distant server too.



    Please test the NoLaggChunks add-on. I have managed to fix all issues I ever saw, but you never know! I adjusted the default settings so most servers will run optimally, but feel free to tweak it a bit. :)

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


    Reporting back on my fly-kick issue: Downgrading to 1.20 didn't help, but disabling the chunk unload delay did. What's strange is that it did work before on RB 1185 with 1.2... Setting it to anything > 0 seems to cause massive issues for me. Any ideas why? Not running out of mem, even happens with lower CPU load (3-4 players). Also had *a lot* of unloaded chunks with it, even if the delay was just 30 secs (tried loweing it). Are you working on this, or do you have any clue what causes this?

    Anyhow, since your chunk addon seems to be finished I'd like to ask if you have any numbers on the additional CPU load. The only resource that I currently run out of is CPU power, since I'm just running an old i7 with 2.66GHz. Connection is 100MBit, so if I could even out the traffic spikes a bit that would be nice, but not at the cost of notably more CPU load.
  7. Offline


    If you have spout but dont enforce it do you need the add-on?
  8. Offline


    @Borch it hardly consumes CPU: all it does is store the packet in a buffer (a list) based on certain criteria. It may increase RAM though, since it stores packets in memory. This does get cleared over time, but a remainder will be kept ready for when the player moves. (to reduce CPU usage when generating the chunks)

    I can't really test, since the CPU is always at 50% regardless if I use plug ins or not. :)
    Note: the add-on does consume quite some RAM as I've seen here, probably because of the chunk packets being kept in memory. (I have to, else areas start to 'clear out')

    @kahlilnc you never need the add-on, you can use it. Spout is required for the add-on and can't really change that...

    Also, missing chunks are out of my control. In the latest update the exact same code (implementation) of PerformanceTweaks is used, and I believe this plugin has been tested thoroughly already...

    Could be that the add-on fixed this issue (haven't seen any of them since), but I can't tell because I host the server locally. (no send delays)
  9. Offline


    SERIOUS ISSUE!!! Something very wrong seems to be happening with nolaggchunks everything seems to work fine for around the first 15 min on the server. Then after that everything that is placed disappears and you have to reconnect to see what you built. however, reconnecting does not fix the issue. I've read up on your tips for what the config file should look like. Played around with it a bit and what not. The only thing that seems to fix the problem is removing Nolaggchunks all together. :( I really like the add-on just not this issue with it. please let me know if you have a fix! thanks!
  10. Offline


    Running 1240 CB, 1.28 nolag, disabled spawnlimiter... No monster spawning.. whats even MORE crazy is if i copy Everything to my back up server thing do spawn..... :confused: backup server running same verisonS
  11. Offline


    @Sk8Sanctified Does your RAM exceed the limit (over 90%) when this happens, or not? Does disabling NoLagg (and only use the add-on) help? I did have the same after a while (trees started to disappear, I had no idea what caused it), but I did see my RAM usage was almost exceeding my total RAM. (I only have 2.5 gb and run a client at the same time)

    @ray0911 are you sure you are not using a second plugin that limits mobs? (Ptweaks or MyWorlds)
  12. Offline


    @bergerkiller ok thanks, I might give it a try later :)

    Just what Sk8Sanctified reported doesn't sound too encouraging actually.
    In general I have the feeling that something's really fishy about the whole chunk loading, unloading and handling in the vanilla server itself.
    It seems to be a very fragile system that just about works most of the time, with loads of bugs that under normal circumstances (almost) never trigger, but they are there, and modifying anything about chunk handling anywhere simply breaks everything.
    I mean we had unloaded chunks in the past in SMP (the non-dark ones in maybe beta 1.1 (or maybe it was still alpha), if anyone remembers), we hat the wiped chests/signs issue in 1.7, and even now every now and then there is an unloaded chunk. This doesn't sound like a robust system at all to me. If only someone with a shitload of spare time would use it to rewrite the whole chunk load/save handling... *dreams*
  13. Offline


    @Borch yup you are right. The main issue is that the server doesn't know if the player has a certain chunk loaded. It does send a chunk...but the client can and will dispose this chunk without the server knowing. Odds are that the server thinks the client has the chunk, but in fact this is not the case! Obvious reason to make the entire system fall.

    It's actually not all that hard to implement a correct system...but it requires client mods or EXTREME precise player tracking for that to work. I added an extra layer of chunk loading, that is the second step, the third would be 'keeping track of player chunks 24/7', but that requires quite some CPU.

    For now, set the chunk unload delay to 0 to prevent unloaded chunks. I did find a '20% working way to reproduce it', but it'll take a bit longer to fully fix the issue.
  14. Offline


    @bergerkiller ouch, didn't even know about the Client<->Server desync issue, but that makes sense. Also, don't know if this is worth mentioning, I found that the unloaded chunks I got by using unloadDelay were a bit different from the "regular" ones: Walking into the regular unloaded chunks made you fall down and glich back up a couple of times a second, as the server repeatedly corrected your position. The unloaded chunks caused by the unloadDelay however apparently even didn't exist on the server, as you could fall right through them into the void and die there. Tracking the player position server side confirmed that it accepted the player falling through the invisible chunk. To me that means that the chunk just isn't loaded server side, but I don't know too much about the position correction code. Maybe it just failed there for some reason.

    With no unload delay, 1.29 is working fine however, good job again. :)
  15. Offline


    @Borch aaa(rg)h thanks! This could actually explain a lot you know! :)

    I already added checks to prevent chunks 'in range of the player' from being forced unloaded...but this contradicts this. I'll take another good look at the code, and mostly, the server coding used to load nearby chunks.

    My guess, about the 'disappearing terrain', is that this chunk got unloaded, but the client still sees it as (partly) loaded. Server-side it is gone, but client-side not. The opposite of what I mentioned is possible too apparently.


    Current coding used:
        private static boolean canUnload(Chunk c) {
            boolean near = false;
            //any players near?
            int view = Bukkit.getServer().getViewDistance();
            for (Player p : c.getWorld().getPlayers()) {
                int cx = p.getLocation().getBlockX() >> 4;
                int cz = p.getLocation().getBlockX() >> 4;
                if (Math.abs(cx - c.getX()) > view) continue;
                if (Math.abs(cz - c.getZ()) > view) continue;
                near = true;
            if (near) {
                touch(c, System.currentTimeMillis());
                return false;
            } else if (!chunks.containsKey(c)) {
                return true;
            } else {
                long expireTime = chunks.get(c) + chunkUnloadDelay;
                return expireTime < System.currentTimeMillis();
    I bet the view distance used is not right, I'll have to use something else...

    Ok re-calibrated the unload delay 'view', please re-try the main NoLagg plugin.

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


    Holy F*** you have been busy , well I guess it is time to test the chunk addon again and the new nolagg.

    I don't see any chunk issues anymore with the chunk addon installed So far zero missing chunks and zero void holes.

    I use these settings

  17. Offline


    Can NoLaggChunks make chunks load faster than default Minecraft? No matter how high I set it, it doesn't just load super fast. I'm trying to see if I can make it absurdly fast for LAN play, or making videos. It might be a client limitation.
  18. Offline


    For that you want Spoutcraft and enable its chunk settings higher just read the button description's. Nolagg and the addon are for lowering CPU and RAM usage aka buffer and slow down the absurd amount of whole chunk sending.

    P.S Notch implemented Integrated Client Chunk cache in 1.9 pre release 3 I wonder how it fairs against this and spout.
  19. Offline


    @ratty you can never magically increase chunk loading rate, the opposite is the case, all the add-on does is limit chunks sending to decrease network usage. You can still set the default rate to 3 and interval to 1 to load incredibly fast, but that kinda ruins the point of having the plugin. However, in combination with a set 'max chunks per tick' it can still be useful.

    It's kinda hard to explain, let's say you take some chunks away and send them later if this is needed, following the rules of the send algorithm and the settings set in the configuration.

    @ledhead900 not much, since the world still needs to be sent to the client, no? :)


    Did encounter a few (weird) issues...
    - When entering regions being generated, freshly added trees (by the populator) get replaced by the previously sent chunk. This is basically an order bug, guess I'll need to find a way to handle the compressed chunks instead of the uncompressed chunks.
    - It appears as if the network buffer gets flooded at some point and the client has to re-join. Absolutely no idea what this is, could even be a Vanilla bug.
  20. Offline


    True but like spouts cache the whole point is to store bits of the chunk the player is in to stop a resend upon block placement instead it just sends the difference. In the long run it becomes faster but on first load it still has to send a complete chunk, from my experiences with spout and the now redundant craftproxy is that the more you play and let the cache fill up in areas you hang around in most the less data that client actually uses within the given chunk.

    Your method is to simply stop chunks being sent when they are not needed such as chunks the player cannot visually see just do not get sent what you are doing is basically Optifog mod but for server end I mean that in a semi reality way by which I mean you are optimizing the chunk rates and sending patterns on the server thus reducing network usage even more when combined with some form of client end cache. Please excuse any miss understood information feel free to correct me so I may learn but I think you understand my overall point. I believe that we shall one day get the combination right as to almost not notice the chunk data as the big impact but until then keep on trucking I suppose I really admire your work and Spouts work I follow both of them almost excessively.

    P.S - Experimental thought pattern below.
    Chunk caching is a step in the right direction but what needs improvement at least looking at it from a larger perspective is the the compression of the chunks before they are sent you see there is a reason the big triple AAA game developers prefer to send the map to the client and store it there ;), we just now need to work out a reliable way to do this in a ever changing world, now for obvious reasons an entire map send is just not plausible for use in minecraft the way it is now due to fact players alter the terrain and it overall size it would actually I think be more intensive on bandwidth and cpu to check and update the world on client end rather then just to re send the chunks. So again I think the solution is to invent MUCH better COMPRESSION of the chunk to be sent to begin with I rather have cpu load then network load the CPU side of things you can combat fairly easily with mods just like yours network side on the other hand often requires core changes in the way the client and server talk.
  21. Offline


    @ledhead900 Yup that is a very good discription. Adding to that, you can set settings player-specific too, to adjust it for players with not-that-good connections.
  22. Offline


    I made a couple of edits if you want to go over them I am trying to not give bad information I simply saying it how I understand it but again feel free to correct me.

    Adding your statement I should then point out that maybe the true solution is to compress better, client cache keeps longer, and client is able to set its own rates up to a maximum allowed defined by the server.
  23. Offline


    @ledhead900 The problem is, however, that changes occur. With limited visiblity it is possible to have a huge explosion going on in one side of the world without the client noticing anything. With a static cache, as you mentioned, this area would not get updated, unless you want to send those chunk updates to the client as well.

    It is possible to keep track of client <> server block differences, but it would require a HUGE amount of RAM. (storing every single block location that got changed, for every player)

    Also, now trying to handle the packets after compression instead of before. Only issue I am facing is packets being received that have uncompressed data...

    Adding to your latest changes: The compression is already 'marvelous'. It brings a 86000 bytes long data down to a slink 1.8 kb in some cases. The main issue is the need of a static map in combination with an ever-changing world...
  24. Offline


    So basically my end point ;) we just need to invent a way that works so that map can be stored on the client but update efficiently when changes are made. I'm also talking about minecraft as a whole not just with mods but also with out them not everyone will get to benefit from what you and other like mined are doing as they simply do not mod servers. Let just try to understand something for a second I notice the server side of things is working but you are facing issues with clients sending back uncompressed data, This would be the reason we require client mods correct ?, If this is the case then the issue again comes down to notch to properly add compression on both ends.

    On a plus side maybe in 1.9 we can harness the implement chunk cache so that we no longer need a client mod for the client end cache like we do now thus making sure almost every user on the server is contributing near the same bandwidth usage. Currently you have to spread the word about custom clients like spoutcraft and pro actively encourage the use of it on your server but I think we can find a way to take control of notch's implement cache system.

    Getting these when players are on, I do not know what they mean.

    2011-10-09 12:24:39 [INFOAttempted to place a tile entity (net.minecraft.server.TileEntityFurnace@4fad7c91at 7,26,(STONEwhere there was no entity tile!
    2011-10-09 12:24:44 [INFOAttempted to place a tile entity
  25. Offline



    Seems that I get the classic beta holes with nolagg chunks. Default config. When I remove nolagg chunks, chunks load much faster and no beta holes.
  26. Offline


    You updated nolagg and the addon, you have spout installed ?, I am not getting holes last I checked since he fixed it.
  27. Offline


    Latest dev build of CB, latest spout dev build, latest nolagg and the addon from the github. =/

    Edit: Let me clarify, when I teleport for example, /spawn, /home, /tp, then I see void holes.

    Edit2: Also using ptweaks, disabled it to see if that was the problem and it wasn't. Using essentials for /home, /tp, /spawn. Also using your config for nolagg and the addon.
  28. Offline


    @bergerkiller Could you tell me what an optimal set of options for NoLaggChunks would be? I'm looking to minimize bandwidth usage as much as possible without crashing the server and/or clients. I see you fixed the issue I told you about - thank you very much for that! :D
  29. Offline


    Have you tried it with Non dev builds of CB and spout ?. I will see if I can replicate such issue.

    I'm using Reco builds of all plugins mentioned only I do not use essentials anymore I use commandbook and Myworlds, The issue you describe does not happen to me at all, I think @bergerkiller had gotten the code almost perfect now as all of my previous issues are gone..
  30. Offline


    'I use dev builds because I get better performance out of it. =/ I use essentials so I don't have to use/find multiple plugins that do everything essentials does.
  31. Offline


    Yes, I'm sure it's not something with my ram. I have 2g set aside for the server, with 4 total on my system. I also run a client at the same time, with around 35% total ram to spare all things running. I haven't tried no chunks with out nolagg though, but I'd rather run nolagg than no chunks. Seems there is another update though with your plugins so I'll give them a go.

Share This Page