Live data from Hacker News

Testing a 1,000 player Minecraft server with Folia

cubxity.dev

91–100 of 166 posts

Re: Testing a 1,000 player Minecraft server with Folia

#91
post #68

I know this isn't the point of Folia's test, but: > During the period when 1,000 players were online, we reached a maximum of ~7.9GB/s heap allocation and our GC was hovering around 2-3GB/s when averaged over a minute. As someone who dealt with soft-realtime telephony stuff, this makes me want to scream in horror. It seems like the platform really hurts the performance here. In an average second with that many player…

This is not an issue with the runtime. If anything, the JVM is handling this really well. The problem is code like: while(game_running) { position = new Box(x,y,z) } instead of reusing objects: while(game_running) { position.set(x,y,z) } plus, Minecraft is not static! There are many thousands of other things moving and changing state in the world.

> This is not an issue with the runtime

Yes. But no. But yes.

The code couldn't been written better to allocate less. But the runtime encourages cheap allocations you don't think about. But the runtime could provide/encourage tooling that makes it hard to make that mistake. But...

It all overlaps. Sure, JVM is cool and handles it, but also what JVM is influenced how people instinctively used it.

Re: Testing a 1,000 player Minecraft server with Folia

#92

Earlier quoted context omitted.

Somewhat orthogonal to what Folia is doing, and already explored by the community. Folia's main trick is to dynamically split the "main game tick loop", where logic and actions are processed into several threads based on location. Such that processing for say a mob farm in the South of the map does not impede on processing for a hopper based storage system in the North West etc. This doesn't solve the everyone's at o…

Is there a solution for the Jita problem that isn't just beefing up the server?

From reading the comments here, it would appear the problem is sending out position updates to all the clients. If each client is on a TCP connection, this will end up being a problem as each movement causes everyone else within range to receive a message. If everyone is moving, that's a heck of a lot of messages everyone is getting. Not only that, everyone needs a copy of the message in their TCP pipe, one at a time, sent from the server. So it quickly explodes. I guess you can think of it as O(N) clients each causing O(N) messages to go out, so it explodes quadratically.

This isn't likely what I'm about to suggest, but you could move to a broadcast type system where you have some sort of UDP broadcast where you simply tell everyone about all the movements, and a alternative negative-ack channel where clients can ask for missed broadcasts. That way only O(N) messages are sent (the magic happens in the network devices). The issue with that is the internet isn't great for packet loss or multicast routing, so if you have O(N) resend requests you're not much better off. If you had all your clients in one datacenter it might work :)

Re: Testing a 1,000 player Minecraft server with Folia

#93
post #33

I'll just drop this factoid: Mineplex has won the Guinness World Records award on January 28, 2015 for having 34,434 concurrent players, the most on a Minecraft server at the time.

Like most Guinness World Records, this absolutely isn't even true. I've regularly seen hypixel with more players than this in the past couple years.

GWR is purely just marketing, none of their records should be taken with any merit.

Re: Testing a 1,000 player Minecraft server with Folia

#94
post #53

I know this isn't the point of Folia's test, but: > During the period when 1,000 players were online, we reached a maximum of ~7.9GB/s heap allocation and our GC was hovering around 2-3GB/s when averaged over a minute. As someone who dealt with soft-realtime telephony stuff, this makes me want to scream in horror. It seems like the platform really hurts the performance here. In an average second with that many player…

> In an average second with that many players, most (all?) of them will not do any action apart from changing their position The world is not static though. Each player loads in a lot of living entities (monsters/animals/...) and block entities (furnaces, redstone, ...) that all need to update. There's some overlap of course, though in a game like Minecraft where there's a near infinite world to explore that overlap…

> Each player loads in a lot of living entities (monsters/animals/...) and block entities (furnaces, redstone, ...) that all need to update.

Sure, but that list of entities in the area is close to static (apart from crazy redstone magic). One would expect them to be pooled and not have many allocations for each tick.

Re: Testing a 1,000 player Minecraft server with Folia

#95

On a side note, I've been trying to figure out how to write Java mods for server-side vanilla Minecraft server, but there is basically no documentation at all. Is it safe to say that this isn't possible? Which flavor of minecraft server is the best documented to write mods for, Spigot?

There are three competing standards right now: - Fabric (and Quilt), which uses a mixins system, a really flexible modding API that can do client and server modification - Paper (and Purpur, Pufferfish, Folia), which is similar to the old-school Bukkit/Spigot ecosystem and supports an intuitive API for server-side plugins. If you're aiming for >30 concurrent players you really need the sorts of performance patching t…

I want to use Minecraft as a sort of platform for teaching my kid how to code.

Which one is the least headache?

Re: Testing a 1,000 player Minecraft server with Folia

#96
post #39

Earlier quoted context omitted.

Ha, nice, thanks. I've never looked into this deeper than accepting the fact that it's doable. Now, if only I had the spare time to look into how did they shard the servers...

ocelotpotpie's sibling reply to this has good explanations for the terminology. If you're curious to actually see the software: * https://www.spigotmc.org/wiki/bungeecord/ - Older, less-performant but still used by some teams * https://papermc.io/software/velocity - Newer, more performant, maintained by the team that makes Paper, one of the leading performance MC server implementations. For context of scale btw, when…

I used to play Minecraft as a child years ago, I also got into mod and plugin development as a kid.

I thoroughly enjoyed creating different game modes, similar to Hypixel. Whenever I would play on Hypixel I’d think about how the games had been implemented.

Seeing this thread brings back a lot of nostalgia. Reading through these comments makes me realise that a lot more work went into these servers than I had ever imagined. Naive me thinking it was just a bunch of spigot servers with bungeecord thrown on top.

I’d love to revisit and get back into it all. Alas, I’m stuck working on software nowadays instead.

Re: Testing a 1,000 player Minecraft server with Folia

#97
post #64

Earlier quoted context omitted.

Why not pool these objects? I'm primarily an Android developer and it's a well-known easy optimization on Android to avoid short-lived objects as much as possible, but especially during drawing and other actions that run every frame. You just don't use the word "new" in onDraw and other related methods. Android Studio would even warn you if you do. But then the new APIs in JDK itself are designed such that you have t…

Allocation is typically really cheap, maintaining pools for objects would likely have more overhead. And while collecting garbage takes resources too, it's heavily concurrently, especially in GCs like Shenandoah and ZGC. So instead of more overhead due to pooling on the thread that uses the objects, you have more overhead on a different thread during garbage collection. So while it makes sense to avoid unnecessary al…

Agreed. Allocation is pretty cheap, but it can still be slowed by an order of magnitude by two things:

1. by using finalizers

2. by using object initialization blocks

If you avoid these two problems you get nano-second performance, because the JVM does not need to run code during object creation and GC.

Re: Testing a 1,000 player Minecraft server with Folia

#98
post #53

Earlier quoted context omitted.

> In an average second with that many players, most (all?) of them will not do any action apart from changing their position The world is not static though. Each player loads in a lot of living entities (monsters/animals/...) and block entities (furnaces, redstone, ...) that all need to update. There's some overlap of course, though in a game like Minecraft where there's a near infinite world to explore that overlap…

> Each player loads in a lot of living entities (monsters/animals/...) and block entities (furnaces, redstone, ...) that all need to update. Sure, but that list of entities in the area is close to static (apart from crazy redstone magic). One would expect them to be pooled and not have many allocations for each tick.

But each has to do a lot of stuff. People on such big servers build farms with hundreds of mobs dropping thousands of items which then go through redstone sorting systems.

Re: Testing a 1,000 player Minecraft server with Folia

#99
post #2

Always fun to continue to see innovation within the Minecraft Java space. At Hypixel we ran (and I believe they still do run) a custom fork of Spigot from 2014-ish, with features from each sequential update to Minecraft being added to our fork via our Spigot fork. This let us diverge greatly and customize the Minecraft protocol to our own needs, saving hugely on internal bandwidth and letting us optimize crap out of…

> Always fun to continue to see innovation within the Minecraft Java space. Just don't expect that innovation to come out of Mojang/Minecraft

Let's all remember that Notch didn't want any multiplayer and purposefully did everything he could to make it painful.

Minecraft would be dead without the community devs and artists.

Re: Testing a 1,000 player Minecraft server with Folia

#100
post #12

Interesting to see how they scale a multiplayer big world. Not many systems try to do this. Improbable, Minecraft, Second Life, and Roblox are the ones I know about. Almost everybody else shards. Any other examples of really big shared seamless multiplayer worlds?

Sorry to self-promote, but, Angeldust (https://angeldu.st) is a single, persistent, real-time voxel world going for about eight years now. Can handle 300+K players on a single server due to massive parallelism. Unfortunately we don't get those player numbers right now, but hopefully in the future!
Post reply on HN