Live data from Hacker News

Testing a 1,000 player Minecraft server with Folia

cubxity.dev

61–70 of 166 posts

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

#61

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…

Minecraft Java used to allocate over 200MB/s per player when moving, and just 50MB/s when static. A lot of it stems back from Minecraft 1.8, where code was updated to take a BlockPos(float x, float y, float z) class instead of just (float x, float y, float z). Pretty much every single object in the game has to deal with its position. Millions of objects allocated per frame, only to be discarded later. Along with a looooot of other questionable choices. It's not even a runtime problem: you'd have the same issues free()'ing that memory on your own. Just stop allocating so damn much.

But then again, Notch never claimed to be a great programmer.

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

#62

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…

Minecraft Java used to allocate over 200MB/s per player when moving, and just 50MB/s when static. A lot of it stems back from Minecraft 1.8, where code was updated to take a BlockPos(float x, float y, float z) class instead of just (float x, float y, float z). Pretty much every single object in the game has to deal with its position. Millions of objects allocated per frame, only to be discarded later. Along with a lo…

the post-1.8 codebase awfulness has nothing to do with the source programmer. hell, by 1.13, the game had practically been rewritten at least once over.

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

#63
post #39

Earlier quoted context omitted.

This is where things start to get a little fuzzy. Mineplex had the most concurrent players but they weren't on a single individual bare metal server or single server jar instance. A lot of large "servers" like Mineplex, Hypixel, etc run a proxy which sits in front of a bunch of other servers. The concept of a "server" can have many meanings in Minecraft so it gets fuzzy quickly. I'm not sure if this 1,000 person test…

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 Hypixel had 200k+ players online at peak we had something like 2,000+ 1U E3-1271v3's each with 32GB RAM, all colo'd in a single DC in Chicago. Egress is 70-80gbps or so 95th percentile, with most months (at high peak) egressing 10PB/mo+ of real-time, uncacheable data.

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

#64

Earlier quoted context omitted.

The Minecraft Java version is notorious for thrashing memory. It allocates and discards objects at an incredible rate, even when the player isn't doing anything. The server has a GUI where you can watch the memory allocation with its distinctive sawtooth pattern.

I'm excited for Project Valhalla to affect Minecraft performance; a lot of the temporary allocations are things like BlockPos objects (a Vec3i, basically) and VoxelShapes (a tree of axis aligned bounding boxes; so, like, an array of a struct that's six f64s) which seem ripe for becoming value objects that are inlined by HotSpot instead of living on the heap

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 to allocate loads of short-lived small objects. I was told that HotSpot does deal with them reasonably well to avoid them degrading the performance, but apparently it isn't very good at it?

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

#65

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…

Minecraft Java used to allocate over 200MB/s per player when moving, and just 50MB/s when static. A lot of it stems back from Minecraft 1.8, where code was updated to take a BlockPos(float x, float y, float z) class instead of just (float x, float y, float z). Pretty much every single object in the game has to deal with its position. Millions of objects allocated per frame, only to be discarded later. Along with a lo…

Just use a struct... Oh wait, Java does not have structs....

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

#66
post #50

https://www.twitch.tv/videos/1849538310 No comment.

(Disclaimer: I'm on the Paper team, and Paper is the org under which Folia sits)

I didn't watch the stream because I was offline when it happened, but I just want to note that the test was run by someone not on the Paper team who got tubbo to stream it, which is how they got so many players. It can be tricky to get enough players for such a large test, so it made sense for cubxity to pair up with someone to get more players.

Twitch can get pretty funky, especially twitch chat, so hopefully there's nothing "bad" in that video, though.

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

#67
post #65

Earlier quoted context omitted.

Minecraft Java used to allocate over 200MB/s per player when moving, and just 50MB/s when static. A lot of it stems back from Minecraft 1.8, where code was updated to take a BlockPos(float x, float y, float z) class instead of just (float x, float y, float z). Pretty much every single object in the game has to deal with its position. Millions of objects allocated per frame, only to be discarded later. Along with a lo…

Just use a struct... Oh wait, Java does not have structs....

Yet.

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

#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.

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

#69
post #57

Earlier quoted context omitted.

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…

> If you're aiming for >30 concurrent players you really need the sorts of performance patching that Paper comes with out of the box, or some custom-developed equivalent to it. Fabric has quite a few performance mods that can achieve the same thing. I launched my new 1.20 map last week, and TPS was hanging on at 40 players without most of them even enabled.

Yep, there are some great performance mods for Fabric. This ecosystem of mods is not quite as thorough as paper, but it is improving over time and there's no technical reason Fabric modding can't be used to bring about scaled-up Minecraft without hiccups.

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

#70

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…

Minecraft Java used to allocate over 200MB/s per player when moving, and just 50MB/s when static. A lot of it stems back from Minecraft 1.8, where code was updated to take a BlockPos(float x, float y, float z) class instead of just (float x, float y, float z). Pretty much every single object in the game has to deal with its position. Millions of objects allocated per frame, only to be discarded later. Along with a lo…

[deleted]
Post reply on HN