Same thing is happening to me, on my Windows server. If I wipe out our world and start anew, the server works. It's only if I use our existing world that the server refuses to work.
World was originally a realm, created after the Nether update. I tried zipping the world, renaming the extension, and importing into Minecraft Bedrock client. Playing the world a bit, the exporting it, and extracting the *.mcworld into a new minecraft bedrock server setup. World is currently just under 500MB.
Still doesn't work. Same error, Unable to connect to world. No log shown of any connection attempt - the client is ejected almost instantaneously.
TL;DR, I am happy that running Windows Server 100% resolved the performance issues. I am not happy about running Windows Server.
The beginning:
@Nathan Telles, @Antoine Talbot
I agree with both of you. The performance is very poor on decent hardware. For me:
Ryzen 3400G (quad core Zen+)
8GB DDR4 2666MHz
250GB NVMe (HP EX900)
Ubuntu Linux 20.04.x - 20.10.x
This server is 100% dedicated to only running Minecraft Bedrock Server.
I ran the Linux bedrock server in a screen (I know tmux is probably preferred). I started on a realm when 1.16 came out. Moved over after a month. Even in relatively light areas, just a single player would often load up the main game thread to ~25% or so. In heavier areas, ~60% or so. In some areas, 100%, and having many villagers in an area will cause the villagers to start stuttering in their movements, as do cows, etc. I'm the most frequent player, but there is one other somewhat frequent player, and a couple other occasional players. We are all friends, so this is just our own server.
Figure 1: One player standing in a relatively light area. One large building, but minimal redstone (one comparator, one repeater, one dispenser, one observer, and a few bits of redstone dust). Pic taken around 03JAN2021, on Ubuntu 20.10 Server running the Linux Bedrock Dedicated Server.
Figure 2: CPU utilization with just one player, near a village of 20 villagers and a few natural farms. Picture taken around 13JAN2021, on Ubuntu 20.10 Server running the Linux Bedrock Dedicated Server.
One thing that is subtle, is everything is a bit slow to react. Doors, buttons, etc. The worst, however, was flying. Basically impossible. Not only was it hard to jump+rocket launch with an elytra, just flying around would constantly result in myself running into "empty" chunks that haven't loaded in yet. Even on a well traveled (flying) path, I would have to wait a while for the chunks to load it. It made travelling between two spots (approximately 1000 blocks apart) very tedious, and exploration was just unenjoyable.
When flying around, all 8 threads of the CPU would be pegged at 100% utilization.
One of the updates in the past month or so (so 1.16.5x - 1.16.2xx) improved performance a tiny bit when flying. With that, I ran into the first chunk walls around around 800 blocks, instead of ~200.
Hardware Upgrade & Disappointment:
I then had the opportunity to upgrade the server hardware.
Ryzen 3600 (hexa core Zen 2)
16GB DDR 3000MHz
1TB 970 Evo Plus
Ubuntu Linux Server 20.04.1 LTS
Performance was a tiny, tiny bit better. CPU loads that were ~90% were now ~70%. But the large village that was (seemingly) causing the 100% CPU load was still 100%. Flying around still loaded up 8 threads to 100% (and a few other threads to some medium-low amount - I left the default 8 thread max, in the server configurations file).
This was just unacceptable. Performance was still abysmal, relative to the large upgrade.
There is no way any major Minecraft bedrock server would be acceptable, if it was running like this. They would need massively expensive CPUs, just to lag out with minimal builds and just one-two players. Not to name names, but stuff like Hypixel and Lifeboat (both available in the default server's list) would be absolutely impossible if this were the case. I have played on their servers, and their performance was far, far better than I was getting with my server. It does not seem possible, given the high single thread performance of Zen 2 (sure, Intel is marginally faster in single thread workloads, but not nearly enough to explain away the extremely poor performance of my server. Furthermore, when running my server's world in a singleplayer, Bedrock instance on my own Zen2 computer, the performance was absolutely fine, without lag, stutters, etc).
One more thing to try:
However, given Mojang is owned by Microsoft, I had to try one more thing. Install the wretched abomination of GUI and poorly implemented ideas (Windows Server 2019 Essentials) onto my current server and running Bedrock Dedicated Server (Windows) off of that, with the same world, and the same settings.
To my absolute shock and horror, everything played wonderfully - it was like playing singleplayer minecraft again! Villagers ran smoothly and quickly across the village, cows stopped stuttering about the field, I could fly as fast as I wanted and as far as I wanted without encountering invisible loading walls. Flying around would only load 1-2 threads on the server ("logical cores" in the Task Manager's utilization window). CPU utilization when in other areas of the world amounted to <20% (and probably single digit percentage) utilization of 1-2 threads.
Figure 3: Windows Server 2019 Essentials. Picture taken on 20JAN2021, running Windows Bedrock Dedicated Server
It wasn't even causing the CPU to really raise its clockspeed - you can see it staying around base clocks. In Linux, single thread loads were pegging the CPU at 4.2GHz and flying was so taxing, the CPU would throttle down to ~3.9GHz. I was able to expand the render distance to 80 with no noticeable downside whatsoever. Simulation distance is 12.
Outcome:
The performance difference was appalling and shocking.
Future:
The next steps are to test the older server with a virtualized Windows Server 2019 Essentials guest, and see if the performance also improves on that hardware. Then see if WINE 6.0 can run the server without Windows, so all of the management scripts I hacked together can be utilized again (based off of a couple of other management scripts I found on GitHub - thanks TheRemote and the other, unknown source). Though I did find an open source management tool for Windows Bedrock Dedicated Server called Vellum that supports hot backups and is written in familiar C#, so I'm working on modifying that to support auto-updates for the Bedrock Server software, so I'm willing to at least keep around a Windows Server guest VM.
Conclusion:
As stated above. The performance difference was appalling and shocking. For now, I'd recommend running WIndows as the server. I don't know if running Windows in a VM would preserve the performance of the Windows Bedrock Dedicated Server, nor do I know if running WINE would preserve the performance of the Windows Bedrock Dedicated Server while running on a Linux OS. For now, I am merely happy with the smooth gameplay.
Following up. Someone on a discord recommended deleting the level.dat file and letting the server rebuild it at startup.
I made a copy of the file (and took another backup of the whole world, for that matter), deleted level.dat, and startup up the server. World now works.