mcl_priv uses a lot of CPU #3368
Labels
No Label
#P1 CRITICAL
#P2: HIGH
#P3: elevated
#P4 priority: medium
#P6: low
#Review
annoying
API
bug
code quality
combat
commands
compatibility
configurability
contribution inside
controls
core feature
creative mode
delayed for engine release
documentation
duplicate
enhancement
environment
feature request
gameplay
graphics
ground content conflict
GUI/HUD
help wanted
incomplete feature
invalid / won't fix
items
looking for contributor
mapgen
meta
mineclone2+
Minecraft >= 1.13
Minecraft >= 1.17
missing feature
mobile
mobs
mod support
model needed
multiplayer
Needs adoption
needs discussion
needs engine change
needs more information
needs research
nodes
non-mob entities
performance
player
possible close
redstone
release notes
schematics
Skyblock
sounds
Testing / Retest
tools
translation
unconfirmed
mcl5
mcla
Media missing
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: VoxeLibre/VoxeLibre#3368
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MineClone2 version: Current master (SHA:
63360bcab2
)What happened?
The
mcl_privs
mod seems to be using an outsized amount of CPU which is causing lag for clients.What should happen:
I'm not familiar with everything that
mcl_privs
does but given it's same, the amount of CPU that it's using seems suspect.Steps to reproduce
Start a new MC2 map using the commit listed above and notice the lag.
FWIW, if I comment out the entire body of the function here, the lag almost disappears entirely.
That is pretty weird. The code is this:
It does not look expensive to me. It only runs when a player joins which is a very rare.
Feels like there is some state issue on the game. I have profiled a lot and I have never seen this being an issue. It feels like players are joining and leaving a lot or this was profiled for a short period when people joined.
If
minetest.get_player_privs
andminetest.set_player_privs
do I/O operations on a storage device, it would makes sense for a slow storage devices to cause execution delays. What does the server run on?We really don't have a way of fixing that, as it's minetest, and the server's hardware.
But, the privs need to be set for the player to function.
If this really is an I/O issue, the privileges for all players can be read in one go and cached in RAM, and written on change. It can't get worse than 100MB RAM for all users, even for large servers.
How much ram do you have, and when playing, how much are you using? Is this HDD?
Its running on a Synology 918+ in Docker. Its been upgraded to have 16GB of RAM. Hearing htat its likely an I/O issue makes me wonder if Docker (specifically bind mounts) might be at least partially at fault. I've heard that they can introduce some overhead where that's concerned.
@ancientmarinerdev
The machine has 16 GB and is free to use as much of it as it wants. I believe the CPU is 4 cores at 1.2Ghz
Is it an ssd or hdd?
Removed the accidental duplicate of the message:
HDD
What OS? and what file system? (it does make a difference).
I'm asking because different operating systems and file systems are better at read/writes... and can also prevent file fragmentation, which causes reads / writes to require a lot more cpu time.
This is also a very solid point. Sadly, also -- due to the way that minetest handles things, external network traffic will also affect it, causing lag for no apparent reason.
Synology uses a Unix-ish OS but I'm not sure of all of the differences. It uses Btrfs as the filesystem.
Within Docker, I'm using the linuxserver/minetest image.
I think my next step is going to be trying to run on a Raspberry Pi 4 without the use of containers to see if that works any better.
If you can, try it out first on a network only connected to the client, and measure cpu performance. (eliminating external influence.)
But I do think that doing it outside of a docker image might be a good idea. I did a quick check, and it looks like docker images are mini virtual machines, so there's going to be a decent amount of overhead, if I understood it correctly.
Was making sure that it wasn't windows (which does a ton of things in the background) and that it was a somewhat modern filesystem, so that we could rule out huge fragmentation of the files. BTRFS is new enough and a good filesystem, but you might check out the journaling that it has enough space, etc., to function properly.
What profiler do you use for this?
@ancientmarinerdev I used the built-in profiler (I think? I didn't realize there were multiple...). Basically, I set
profiler.load = true
in myminetest.conf
, started a map, played for a few minutes, and then used/profile save txt
to output the results.if you search jitprofiler on contentDB, it comes highly recommended.
I will check out the built in one on mine too.