This discussion started with me and rnd while analyzing dedicated minetest game server performance and processor consumption per MOD when we though of sharing this in dedicated topic where everyone can contribute and share his/hers experience and solutions regarding performance improvements on (dedicated) online servers.
For measuring performance i have used these commands and settings in minetest.conf (below) what shows detailed overview of processing power consumption on live/online server with players after some time (hrs/min) being online:
Code: Select all
### Profiling
# Load the game profiler to collect game profiling data.
# Provides a /profiler command to access the compiled profile.
# Useful for mod developers and server operators.
# type: bool
# profiler.load = false
# The default format in which profiles are being saved,
# when calling `/profiler save [format]` without format.
# type: enum values: txt, csv, lua, json, json_pretty
# profiler.default_report_format = txt
# The file path relative to your worldpath in which profiles will be saved to.
# type: string
# profiler.report_path = ""
# Have the profiler instrument itself:
# * Instrument an empty function.
# This estimates the overhead, that instrumentation is adding (+1 function call).
# * Instrument the sampler being used to update the statistics.
# type: bool
# instrument.profiler = false
Code: Select all
instrumentation | min µs | max µs | avg µs | min % | max % | avg %
------------------ | --------- | --------- | --------- | ----- | ----- | ------
flowers: | 0 | 83271 | 92 | 0.0 | 91.9 | 0.3
sethome: | 0 | 101 | 0 | 0.0 | 4.8 | 0.0
spawners_ores: | 0 | 1450 | 15 | 0.0 | 27.8 | 0.3
unified_inventory: | 0 | 66648 | 155 | 0.0 | 95.9 | 1.8
easyvend: | 0 | 285937 | 1133 | 0.0 | 96.7 | 1.7
u_skins: | 0 | 299552 | 495 | 0.0 | 97.5 | 0.5
worldedit_commands:| 0 | 227573 | 19 | 0.0 | 98.2 | 0.1
wieldview: | 0 | 2937 | 9 | 0.0 | 36.9 | 0.1
afkkick: | 0 | 63964 | 103 | 0.0 | 92.1 | 2.1
basic_machines: | 0 | 546543 | 4479 | 0.0 | 99.3 | 2.0
mobs_animal: | 50 | 70579 | 778 | 0.0 | 94.4 | 9.6
city_block: | 0 | 3405 | 5 | 0.0 | 45.8 | 0.0
fire: | 0 | 8213 | 181 | 0.0 | 74.2 | 1.5
protector: | 0 | 29675 | 107 | 0.0 | 73.7 | 0.8
*profiler*: | 1 | 1156 | 71 | 0.0 | 60.5 | 1.8
areas: | 0 | 61730 | 176 | 0.0 | 92.4 | 3.7
hudbars: | 0 | 1225 | 12 | 0.0 | 10.5 | 0.1
farming: | 0 | 12077 | 50 | 0.0 | 52.0 | 0.1
enhancements: | 10 | 58896 | 131 | 0.0 | 92.4 | 2.8
hbhunger: | 0 | 67522 | 96 | 0.0 | 93.0 | 1.6
hbarmor: | 0 | 490 | 10 | 0.0 | 5.9 | 0.1
mapfix: | 0 | 40175 | 6 | 0.0 | 93.9 | 0.0
creative: | 0 | 9628 | 31 | 0.0 | 13.4 | 0.1
bones: | 0 | 7815 | 1 | 0.0 | 32.8 | 0.0
pbj_pup: | 0 | 408 | 0 | 0.0 | 8.7 | 0.0
spawners_env: | 0 | 320 | 0 | 0.0 | 4.2 | 0.0
mobs_monster: | 129 | 1559317 | 4562 | 0.1 | 99.8 | 37.2
spawners_mobs: | 14 | 720879 | 1866 | 0.1 | 99.1 | 20.9
give_initial_stuff:| 0 | 234 | 0 | 0.0 | 0.2 | 0.0
xpanes: | 0 | 11758 | 3 | 0.0 | 52.3 | 0.1
beds: | 0 | 156 | 0 | 0.0 | 4.5 | 0.0
throwing: | 0 | 1014 | 0 | 0.0 | 16.8 | 0.0
3d_armor: | 0 | 3001 | 5 | 0.0 | 55.4 | 0.1
mobs: | 0 | 75 | 0 | 0.0 | 1.3 | 0.0
anticheat: | 0 | 5789 | 4 | 0.0 | 14.6 | 0.1
mob_horse: | 0 | 64630 | 108 | 0.0 | 81.5 | 1.5
carts: | 0 | 659 | 0 | 0.0 | 4.6 | 0.0
chat_anticurse: | 0 | 262 | 0 | 0.0 | 7.5 | 0.0
xdecor: | 0 | 3043 | 2 | 0.0 | 12.7 | 0.0
sfinv: | 0 | 57 | 0 | 0.0 | 0.7 | 0.0
obsidianmese: | 0 | 54433 | 81 | 0.0 | 38.4 | 0.1
player_api: | 0 | 62785 | 111 | 0.0 | 92.5 | 2.2
xban2: | 0 | 2065 | 5 | 0.0 | 94.1 | 0.1
default: | 21 | 62285 | 377 | 0.0 | 94.8 | 6.6
Sorted by 'heavyness' = average cpu use per server step (0.1s?):
BIG PROBLEM (together 58% > 50%):
1.mobs_monster: | 129 | 1559317 | 4562 | 0.1 | 99.8 | 37.2
2.spawners_mobs: | 14 | 720879 | 1866 | 0.1 | 99.1 | 20.9
LOW PROBLEM (together <20%)
3.mobs_animal: | 50 | 70579 | 778 | 0.0 | 94.4 | 9.6
4. default: | 21 | 62285 | 377 | 0.0 | 94.8 | 6.6
NO PROBLEM:
5. areas: | 0 | 61730 | 176 | 0.0 | 92.4 | 3.7
6. player_api: | 0 | 62785 | 111 | 0.0 | 92.5 | 2.2
+ ALL OTHER MODS : < 20% avg cpu time
In other words, top 3 mods contribute to 67% of all cpu burden. Spawner ores perform much better cause 'ore' is a dead-inactive thing. What happens when all mods combined exceed available cpu? -> LAG. Because all the operations in progress are first completed, only then other things can continue working.
Some ideas how to fix mobs:
1. Limit number of total active mobs at any moment to reasonable number ( 100? 50?)
Some mobs do heavy things like path finding every server step - sounds extremely wasteful.
2. Improve spawning process of mob ( heavy search for spawn points is no-no)
Very interesting data, expected
protector: | 0 | 29675 | 107 | 0.0 | 73.7 | 0.8
to be little more. Also funny, afkkick mod has 2.1% while basic_machines have 2.0%, seems all the
'optimizations' i did pay off heh.
Do you have an suggestions how to improve certain MODs or do you have a problem with performance on your server? Post it here because it's the time to care more!