It's happened - NOW OPENSOURCED: https://github.com/ezdiy/MaxTPS
Current maintainers dont have the time to support the plugin atm, NEW MAINTAINERS ARE WELCOME! It's most likely we'll return back to the development in a few months, but there is no point holding back code people are finding useful (and constantly bugging us about it).
Ie, we will give up this project to the first guy who ports it to 1.2 & writes new docs (MaxTPS 2 replaces several parts of minecraft, it also does some more drastic things - like sending far chunks off-server directly from .mca files!)
Forum thread for latest updates/releases (this wiki lags behind!): http://forums.bukkit.org/threads/admn-fix-maxtps-get-maximum-tps-1-2-2-r0.62732
Max TPS is a plugin to reduce server lags on most of larger (50+ man) Bukkit servers.
Although best results are observed in combination with, it works unlike most of the unofficial Bukkit forks aiming at performance.
The performance is maintained by wisely limiting two heavily taxing things in Minecraft:
- number of loaded chunks. This is achieved by dynamically adjusting view-distance.
- number of entities spawned
Most of the time, about 20% to 30% performance gains are observed without affecting gameplay much, after that you'l have to resort to dirty tricks such as limiting growth rate and hard mob spawn limits or view distance below 5. Detailed info about things lagging your server are obtained via /lag command, it looks like this:
/lag 05:14:24 [INFO] There are 5739 entities, 152 players, 1405 spawnermobs 05:14:24 [INFO] [############________]/Mem u=6106M f=3792M t=9898M 05:14:24 [INFO] [####################]/Chunks 36722/30000 (122%) 05:14:24 [INFO] [##################__]/1min TPS 18.02 avg, 19.24 abs 05:14:24 [INFO] [###################_]/1sec TPS 19.94 avg, 19.87 abs 05:14:24 [INFO] [##########__________]/VDist 7 = 225 chunks (3 - 15)
BEWARE! To coexist with NoLagg disable mob spawn limits and item stack merging in NoLagg!
Number of chunks in the world
Every player in game is surrounded by loaded chunks, this is so called 'view-distance' in server.properties. This setting affects server performance drastically, first some numbers:
view-distance=1: 9 chunks view-distance=2: 25 chunks view-distance=3: 49 chunks view-distance=4: 81 chunks view-distance=5: 121 chunks view-distance=6: 169 chunks view-distance=7: 225 chunks view-distance=8: 289 chunks view-distance=9: 361 chunks view-distance=10: 441 chunks view-distance=11: 529 chunks view-distance=12: 625 chunks view-distance=13: 729 chunks view-distance=14: 841 chunks view-distance=15: 961 chunks
So for 50 people online, there must be 50*961=48050 chunks loaded at the same time if you're using view-distance of 15 (14450 for view-dist 8 etc). This is of course worst-case scenario, sometimes people are closer together than view distance, thus sharing some chunks.
Minecraft processes every chunk loaded, every tick. This imposes hard limit, because best of todays modern CPU/bus architectures seem to be capable of handling 30k chunks per core max, tps goes down the drain quickly after that.
A way around it is to simply never go that high with chunk count - just define maximum number of chunks your server is capable of handling and adjust view distance according to that. So lets assume your server is capable of handling of 15k chunks.
max-dist: 15 min-dist: 3 chunk-limit: 15000 up-interval: 30 down-interval: 300 tps-threshold: 18.5
routine check, 50, 60, 100 and 200 people online:
- 15000/50 -> 300 chunks per head, switch to view distance 8
- 15000/60 -> 250 chunks per head, switch to view distance 7
- 15000/100 -> 150 chunks per head, switch to view distance 5
- 15000/200 -> 75 chunks per head, switch to view distance 3
Checks if view-dist can be adjusted are done in definable interval, increase every 30 seconds, decrease every 5 minutes.
Try to have up and down intervals as far apart as possible, to prevent oscillations. This is because truly hard limits on chunk count cannot be really imposed, some plugins like them always loaded, some other plugin might be unloading some by force .. we're just playing guessing game, however it works reasonably most of the time.
NEW! Because chunk counts are usually meaningless until significant amount of people are online on the server, view-dist increases are applied ONLY if current TPS is above tps-threshold, likewise decreased when current TPS is below tps-threshold. The aim for defined chunk count still applies, though.
Figuring out the limits of your server
- Install this plugin and check /lag routinely.
- Try to find the point when TPS starts going down below your taste and try /maxchunks 14000 followed by /viewdist command without arguments to enforce the change immediately.
- Keep repeating 2. while decreasing the number until TPS is back to where you want it.
Use /mindist, /maxdist and /viewdist with argument only if you truly understand how it works and the implications!
Limiting number of entities in the world
item-stacking-radius: 3.5 mobs-per-spawner: 30 spawner-check-interval: 30 ticks-per-monster: 1 ticks-per-animal: 400
At this moment, item and experience orb merging is used. Another source of lag are XP traps built by players around mob spawners. Every time a spawner creates a monster, it is added to a list of mobs spawned in that chunk. If the mob count exceeds the limit per chunk, no further monsters are spawned by mob spawners in there. "Natural" mob spawn is not affected by this. Mobs remember which chunk they were born in, and the limit will be replenished whenever they despawn/die.
The check if spawner can be re-enabled is performed every spawner-check-interval. This is because bukkit provides NO MEANS of notification when monster despawns, so we have to count em all once in a while.
NEW: It is now possible to modify number of ticks after which server tries to spawn monster or animal. Increasing ticks-per-monster to 10 or more can reduce server lags under some circumstances (note that this may affect gameplay because mobs spawn at lower pace).
- Orebfuscator seems to work fine
- NoLagg 1.70 and higher appears to work correctly - but disable item stack forming and and spawn limits (MaxTPS implements its own, supposedly better).
- This plugin is written in Groovy language, it depends on its runtime - McGroovy. It's included in the .zip, just so that you're not surprised.
- ChunkManager seems to work fine, but set /maxdist 10 to prevent unnecessary overhead (CM ignores view-distance larger than 10)
This is planned for 1.2 release of bukkit:
- completely custom, smart random monster spawning can reduce mob count to roughly 1/3
- try to move Packet51MapChunk completely out of main thread, thus making chunk loads asynchronous
- /lag - shows neatly formatted view of critical server resources (tps, memory usage, view distance, mob counts...)
- /tps - alias for lag
- /viewdist - force immediate view distance change
- /maxdist - set maximum view distance for auto-adjust
- /mindist - set minimum view distance for auto-adjust
- /upinterval - interval to try to increase viewdist by 1 (up to maxdist)
- /downinterval - ditto, but for decrements
- /chunklimit - number of chunks your server is capable of handling. 5-10k small VPS, 15-25k dedicated, 25-40k big iron
- /mtreload - reload from config file
- /stacking - set stacking radius (0 to disable)
- /spawnerlimit - limit number of mobs per spawner chunk
- /tpanimal - ticks per animal spawns (400 default = spawn animal every 20 seconds)
- /tpmonster - ticks per hostile monster spawns (1 default = spawn 20 mobs every second)
- /threshold - Set TPS threshold for MaxTPS to start affecting view distance. Increases viewdist (up to chunklimit) when current tps is above this number, decreases when current TPS is below this threshold
All permissions are in the format of tps.commandname, for example tps.lag should be given to everyone, the rest only to administrators.
- Date created
- Mar 01, 2012
- Last update
- Mar 05, 2012
- Development stage
- All Rights Reserved
- Curse link
- Recent files