Geyser icon indicating copy to clipboard operation
Geyser copied to clipboard

Lag for bedrock players

Open hw2007 opened this issue 1 year ago • 28 comments

Describe the bug

Bedrock players experience noticeable lag on geyser servers. On an xbox which usually gets 60fps, it looked more like 30.

To Reproduce

  1. Join a regular bedrock server/world, take note of the framerate
  2. Join a geyser server from that same bedrock client, and notice how there is noticeably more lag.

Expected behaviour

Bedrock players should not be as laggy

Screenshots / Videos

Here is the world file this was observed on: https://www.mediafire.com/file/uiclzi4rq3czh8c/world.zip/file

Server Version and Plugins

Minecraft 1.20, Fabric loader 0.14.21, Fabric installer version 0.11.2

Geyser Dump

https://dump.geysermc.org/t95VuRzAz4aN8JvqEBet3PnWdC0tzT9x

Geyser Version

Geyser version 2.1.1-SNAPSHOT (git-fabric/lecterns-f3cc93c)

Minecraft: Bedrock Edition Device/Version

Occurs on all devices tested on which are iOS and xbox, probably happens everywhere though

Additional Context

Lowering the bedrock client's render distance has no effect on the issue, neither does disabling custom skulls in the geyser settings.

hw2007 avatar Jun 08 '23 04:06 hw2007

Can you provide the world or make the server accessible?

Konicai avatar Jun 08 '23 05:06 Konicai

Member

I'm not sure if I know enough about minecraft worlds to feel safe doing that.. are players' ip addresses or any other sensitive info stored anywhere in world files?

hw2007 avatar Jun 08 '23 05:06 hw2007

No, IP's are not stored there.

onebeastchris avatar Jun 08 '23 14:06 onebeastchris

No, IP's are not stored there.

Okay, then I've added it to the report

hw2007 avatar Jun 08 '23 15:06 hw2007

I can reproduce, android tablet, I've moved from a paper server to a fabric server, but also updated geyser, framerate seems to have almost halved.

williamjohnstone avatar Jun 08 '23 17:06 williamjohnstone

I had this problem too after i migrated my server form Aternos to a better host, and i noticed that was strange how the players wasn't experiencing that before, and i tought that might be because many things were being loaded or maybe and i read something about Java garbage colectior and things like that, and i tried some things and got the problem solved

First: Changed my startup settings from

java -Xmx4096M -Xms4096M -jar spigot.jar nogui

To

java -Xmx4096M -Xms512M -jar spigot.jar nogui

Second: Lowered the server render distance and simulation distance, you can do this on the server.properties file

i had 32 view distance and 10 simulation distance, i changed both to 5

These things woked for me and the players can play properly from their bedrock clients

WandersonFeitosa avatar Jun 08 '23 21:06 WandersonFeitosa

I can reproduce, android tablet, I've moved from a paper server to a fabric server, but also updated geyser, framerate seems to have almost halved.

Thats the exact same thing I did. I moved from paper to fabric, updated geyser, and then the framerate for bedrock halved!

hw2007 avatar Jun 09 '23 03:06 hw2007

Turning down server view distance seems to be improving the situation a lot, to be clear I also changed my view distance from 10 chunk to a number quite a bit higher, I forgot about this during my last comment.

I now have it set at 12 and it seems to be a lot better. I wonder if this is still an issue with geyser or just an issue with the capabilities of the devices bedrock is running on.

williamjohnstone avatar Jun 09 '23 18:06 williamjohnstone

Turning down server view distance seems to be improving the situation a lot, to be clear I also changed my view distance from 10 chunk to a number quite a bit higher, I forgot about this during my last comment.

I now have it set at 12 and it seems to be a lot better. I wonder if this is still an issue with geyser or just an issue with the capabilities of the devices bedrock is running on.

Its an issue with geyser, I tried joining a regular bedrock server and the lag was gone.

Also made sure to go to an area with no redstone or entities to rule that out, and the lag is still there.

hw2007 avatar Jun 09 '23 20:06 hw2007

I wonder if this is still an issue with geyser or just an issue with the capabilities of the devices bedrock is running on.

Seeing as it runs much better on regular bedrock servers (which I've also tried, so can confirm), I don't think it's a client hardware limitation. Especially considering it happens on my desktop with a Ryzen 5 5600X and RTX 2070 Super (more than capable of running the game flawlessly at high frame-rates), in addition to the Nintendo Switch. Admittedly, it feels far worse on the Switch - it's basically unplayable. On PC, it's still noticeably choppier than on a regular bedrock server.

I also tested with the same world converted from Bedrock to Java using chunker.app, as well as loading up new worlds with the same seed on both. The issue persists.

I've tried running Geyser with Purpur, Paper, Spigot and Fabric, so it seems to me that it's a Geyser issue.

I really hope this can be fixed, as having to turn down view distance server-wide is a pretty big compromise.

SingerJonathan avatar Jun 14 '23 09:06 SingerJonathan

Hi, if you have access to a 1.19.80 install of the game, could you please validate if this issue is still present in 1.19.80 on the same world on the latest version of Geyser (since protocol wise we still support 1.19.80)? I would assume the most practical way to do this would be with the unofficial bedrock launcher if you have the Windows version of the game. Ideally this would be done on the same device.

Kas-tle avatar Jun 14 '23 20:06 Kas-tle

It seems to me that the Fabric Version of Geyser MC has a performance issue/bug. I have the same issue on Bedrock Win 10, no issues on Bedrock PE, Haven't been able to test Xbox. I was told to add this bug report from discord to the github and found someone with the same issue so have added as a reply.

Hello,

I have added geyser+floodgate to my fabric server. I have sodium+lithium mods on the server (server side performance improvement only). I have run into a weird issue? Java works fine. Playing Bedrock on the server with my mobile device works fine. I haven't been able to test Xbox since I don't have one.

Playing MC for Windows 10 on the server with my Gaming PC has strange performance issues. I have had times where I join and here hitting the ground and see rain but have no world or entities render in, I must leave and rejoin. I have had issues with all entities being intermittently frozen in place and then rubber band into place (most often right after joining but can happen later). I have had issues when using the boat where it takes a long time to get in the boat after clicking it, and getting out of it, after getting out the server is frozen for 5s or something because I get rubber banded on top of the boat for 5s then it catches up again and I can walk around. Pushing boats around with the player body is very laggy/glitchy. Mobs are clearly rubber bandier on MC for Win 10 then on the Pocket Edition. FYI I had it crash the whole app when trying to use a time set command which I have heard is the "command suggestion option". Why would my pocket edition work so much less glitchy the the PC based Minecraft? Shouldn't they be the same load on my servers performance? It's basically unplayable on PC but the PE is fine. I feel like this is a result of bug as the experience is different on different platforms. The ram usage on my server Graph is only half or less when on and the CPU load is negligible. It's a 3gb RAM from Apex hosting.

Server: wholewheaty1890836.apexmc.co

To Reproduce, Apex Server Hosting, 3gb RAM, MC 1.20.1, Fabric, GeyserMC+Floodgate, Server Mods: Fabric API 0.85.0, Floodgate, Geyser, Lithium 1.20.1 0.11.2, Sodium 1.20.1 0.4.10 build 27. Suggestion: Put 7 boats in the ocean together, run into boats, get in and out of boats, look at movement and interact with mobs after doing it.

Here is my dump with just a single Win 10 user on the server https://dump.geysermc.org/8G8kEIdrZN2VyHzbQv94XTyhmpBXG0MI

15wileyr avatar Jul 28 '23 18:07 15wileyr

It seems to me that the Fabric Version of Geyser MC has a performance issue/bug. I have the same issue on Bedrock Win 10, no issues on Bedrock PE, Haven't been able to test Xbox. I was told to add this bug report from discord to the github and found someone with the same issue so have added as a reply.

Hello,

I have added geyser+floodgate to my fabric server. I have sodium+lithium mods on the server (server side performance improvement only). I have run into a weird issue? Java works fine. Playing Bedrock on the server with my mobile device works fine. I haven't been able to test Xbox since I don't have one.

Playing MC for Windows 10 on the server with my Gaming PC has strange performance issues. I have had times where I join and here hitting the ground and see rain but have no world or entities render in, I must leave and rejoin. I have had issues with all entities being intermittently frozen in place and then rubber band into place (most often right after joining but can happen later). I have had issues when using the boat where it takes a long time to get in the boat after clicking it, and getting out of it, after getting out the server is frozen for 5s or something because I get rubber banded on top of the boat for 5s then it catches up again and I can walk around. Pushing boats around with the player body is very laggy/glitchy. Mobs are clearly rubber bandier on MC for Win 10 then on the Pocket Edition. FYI I had it crash the whole app when trying to use a time set command which I have heard is the "command suggestion option". Why would my pocket edition work so much less glitchy the the PC based Minecraft? Shouldn't they be the same load on my servers performance? It's basically unplayable on PC but the PE is fine. I feel like this is a result of bug as the experience is different on different platforms. The ram usage on my server Graph is only half or less when on and the CPU load is negligible. It's a 3gb RAM from Apex hosting.

Server: wholewheaty1890836.apexmc.co

To Reproduce, Apex Server Hosting, 3gb RAM, MC 1.20.1, Fabric, GeyserMC+Floodgate, Server Mods: Fabric API 0.85.0, Floodgate, Geyser, Lithium 1.20.1 0.11.2, Sodium 1.20.1 0.4.10 build 27. Suggestion: Put 7 boats in the ocean together, run into boats, get in and out of boats, look at movement and interact with mobs after doing it.

Here is my dump with just a single Win 10 user on the server https://dump.geysermc.org/8G8kEIdrZN2VyHzbQv94XTyhmpBXG0MI

well, firstly of all, sodium it's not a server side mod, but i really dont know, i just can get the windows 10 crash when using comands and the rain bug.

guifenske avatar Jul 28 '23 19:07 guifenske

Yeah I didn't know, I've removed it and retested. Still having the issues so not the issue, now it's just Lithium and Fabric API.

15wileyr avatar Jul 28 '23 19:07 15wileyr

Yeah I didn't know, I've removed it and retested. Still having the issues so not the issue, now it's just Lithium and Fabric API.

yeah it will not change anything since it not load when in a server. But its really weird...

guifenske avatar Jul 28 '23 19:07 guifenske

Like just joined and it never loaded more than the skybox. After removing Sodium from the server, the boats seem to perform slightly better... yeah it's weird, bedrock win 10 is definitely a glitchier experience still. Staring at the skybox, have to join again.

15wileyr avatar Jul 28 '23 21:07 15wileyr

Moved my comment here from #3233

Im getting the same reported lag issues with Geyser running on Waterfall in front of a Paper 1.20.1 server with floodgate running on both Waterfall and Paper.

The moment I connect a Bedrock player to the server there is a massive lag spike, TPS tanks and the server cant keep up even on solid hardware. The lag persists even after the bedrock player disconnects, and is only fixed by restarting the server. If I remove geyser+floodgate and just connect a Java player there is no lag whatsoever. I tested this from Android, Nintendo Switch, and Windows 10 Java.

I noted from another thread about this issue that others noticed the lag is especially bad whenever the bedrock player interacts or even moves along a block, and in my testing I found the same result. Theres a massive lag spike when the bedrock player connects, but if they dont move at all the lag stabilizes a bit, but then as soon as they move the lag is even worse that the initial connection. Others suggested that the issue is somewhere in the packet translation between Java and Bedrock, specifically the differences in the coordinate system, but im not setup to verify that currently.

Hopefully this issue is resolved or being looked at, because as for now I simply cannot use geyser on my server so no bedrock players can connect until I find a fix for this.

makcuber avatar Jul 29 '23 15:07 makcuber

Can you send us a Spark dump?

Spark is a plugin that helps you monitor performance for you server. https://spark.lucko.me/download

To record performance on your server use: /spark profiler --thread * --timeout 60. This will run for 60 seconds then it will automatically stop. Send us the link when prompted.

Camotoy avatar Jul 29 '23 17:07 Camotoy

Fabric 1.20.1 Server no one on server: https://spark.lucko.me/ykljDdscWY one Java Player only: https://spark.lucko.me/pFHy9Ge97i one Java Player only jumping in and out of boats: https://spark.lucko.me/Kg4MEWO6yf one Java Player only connecting and disconnecting: https://spark.lucko.me/Iso4UOSZMD one Bedrock for Win 10 only: https://spark.lucko.me/OjvnyoNuJT one Bedrock for Win 10 only jumping in and out of boats: https://spark.lucko.me/tk36kygPtH one Bedrock for Win 10 connecting and disconnecting: https://spark.lucko.me/4BCk8Oull8 one Bedrock for Android only: https://spark.lucko.me/gDhnXDcqMP one Bedrock for Android only jumping in and out of boats: https://spark.lucko.me/1hcpeiroOE (Managed to get some errors crashing boats into each other (Server thread/WARN Boat moved wrongly! 0.30840200986406785)) one Bedrock for Android connecting and disconnecting: https://spark.lucko.me/EULiORgRXF

One Android and One Java: https://spark.lucko.me/MuXqiVluG4 One Win 10 and One Java:https://spark.lucko.me/bswOsEYcb4 (Even in the testing of the Win 10 + Java, it had a bit more positional lag it seemed on win 10 then the android, looking at the java and bedrock screens (about ~20ms difference) , I had a moment where Win 10 position froze until I highlighted the window and swung an axe then it rubber banded to being updated, that intermittent freezing kind of thing seems to have happened during the spark test above). I am running Java and Bedrock clients on the same PC but when I first had these issues it was only Bedrock Win 10 Open.

15wileyr avatar Jul 30 '23 07:07 15wileyr

Hello, if you are still experiencing this issue could you please see if the latest build of Geyser improves things at all? We were apparently using an older chunk format. This can sometimes have a performance impact as the client has to do some additional processing for each chunk to convert it to the new format. This was updated in this PR: https://github.com/GeyserMC/Geyser/pull/4040.

Kas-tle avatar Aug 07 '23 15:08 Kas-tle

Seems to still be an issue, significantly more lag on mobile clients than before we updated to 1.20

williamjohnstone avatar Aug 07 '23 16:08 williamjohnstone

I upgraded the Geyser version as Kas-tle suggested, the performance is better than before but still not great. like was fine but after a tp command my bedrock win 10 lag stormed for 25seconds, never has happened on my phone.

I TAKE BACK WHAT I SAID lol. Java performance is now substantially worse, i'm rubberbanding constantly on my Ice boat Track, (Wasn't before) seems the new release introduce a different/new performance bug to the server or java players. I'm reverting to the old release I used now. (Always backup, speaking to myself lol)

15wileyr avatar Aug 08 '23 03:08 15wileyr

I dont see how that PR would drastically affect Java performance, if at all.. Mind sending a spark profile with that new update?

onebeastchris avatar Aug 09 '23 03:08 onebeastchris

Yeah, I cannot overstate how extremely unlikely it is that that commit caused the regression you speak of. Geyser doesn't handle Java connections, so the only way that Java Edition gameplay can be impacted is if the server ends up lagging noticeably – severe TPS loss

Konicai avatar Aug 09 '23 03:08 Konicai

Hello, if you are still experiencing this issue could you please see if the latest build of Geyser improves things at all? We were apparently using an older chunk format. This can sometimes have a performance impact as the client has to do some additional processing for each chunk to convert it to the new format. This was updated in this PR: #4040.

Hey! Sorry for not responding, forgot about this thread. I just updated my geyser and it is still happening. It is experienced best on my iPad Pro from 2021. On the geyser server, I average around 15-20 fps, with input latency. On a normal bedrock server it is a smooth 60.

hw2007 avatar Aug 22 '23 00:08 hw2007

I just disabled geyser and floodgate today and found out it was the root cause of an issue that has been plaguing me for the past couple minecraft versions.. The lag isn't just limited to bedrock players, it also causes Java players to lag badly. Login time increases by several seconds and mob positions will randomly pause and resume updating. Fighting silverfish with geyser disabled is night and day. At first I thought it was an issue with purpur, but nothing specific showed up in the spark timings report, and users in the purpur discord said there was no tick lag. Something geyser is doing is causing extreme ping issues, I'm not sure if it holds Java packets while it is translating them or what, but there is a problem and it needs to be fixed.

benduckwdesign avatar Nov 28 '23 17:11 benduckwdesign

I assume this is with Geyser-Spigot? Sending a Spark report would be desirable.

Camotoy avatar Nov 28 '23 17:11 Camotoy

I assume this is with Geyser-Spigot? Sending a Spark report would be desirable.

https://spark.lucko.me/G2dke0spME

As I mentioned, nothing shows up in the spark report, so its pretty much useless. The only thing you can see is high ping.

image

benduckwdesign avatar Nov 29 '23 00:11 benduckwdesign

Closing this issue given the reproduction steps are not specific and this seems to have strayed off into general performance issues. If these can be reproduced specifically on a certain platforms or in certain conditions, please open a new issue with that info specified.

Kas-tle avatar Mar 17 '24 04:03 Kas-tle

What exactly is lag except for a "general performance" issue? Clearly this is reproducible or I wouldn't have been the only one here with rubber-banding issues and stop-the-world levels of lag when joining a server. These things, again, disappear when Geyser is removed. I had the exact same experience as makcuber, unless you think a server with Ryzen 3900XT at 4GHz and 16G of memory is somehow too underpowered for Geyser.

I get this is free software and community effort. But I've seen too many issues die and never get fixed across other projects to not leave a comment in response. Yes, this is a difficult issue because there are no leads in Spark timings. That just means we are asking the wrong questions. Spark doesn't profile virtual threads, and it doesn't tell you how many times a function is called within the same tick. What if some packet translation code is getting called multiple times when it only needs to be called once (exacerbated by logins?) What if it's related to JVM flavor? A Java network stack quirk? Are connections being flushed regularly? Does Spark actually track every function in this JAR, or are there untracked background workers in virtual threads that are getting stuck?

If a maintainer couldn't reproduce the issue, they should have left a comment with details on how they set it up so we can help figure out the issue together.

benduckwdesign avatar Mar 22 '24 06:03 benduckwdesign