Live data from Hacker News

Native Minecraft servers with GraalVM Native Image

github.com

41–50 of 92 posts

Re: Native Minecraft servers with GraalVM Native Image

#41
post #37

Earlier quoted context omitted.

On some micros Graal beats C2, on some others it doesn't. It's not a silver bullet. GraalVM is regular OpenJDK with the compiler switched out, AFAIK.

> GraalVM is regular OpenJDK with the compiler switched out, AFAIK. Do you have a source for this? Or how do you know?

Just look at the 22.2 release notes [1]:

> Updated the OpenJDK release on which GraalVM Community Edition is built ...

and

> Updated the Oracle JDK release on which GraalVM Enterprise Edition is built ...

[1] https://www.graalvm.org/release-notes/22_2/

Re: Native Minecraft servers with GraalVM Native Image

#42
post #37

Earlier quoted context omitted.

> GraalVM is regular OpenJDK with the compiler switched out, AFAIK. Do you have a source for this? Or how do you know?

Just look at the 22.2 release notes [1]: > Updated the OpenJDK release on which GraalVM Community Edition is built ... and > Updated the Oracle JDK release on which GraalVM Enterprise Edition is built ... [1] https://www.graalvm.org/release-notes/22_2/

Got it, thank you @fniephaus. Really appreciate the info, and please keep up the fantastic work!

Re: Native Minecraft servers with GraalVM Native Image

#43
post #35
post #28

Earlier quoted context omitted.

Startup times (especially for 'on demand' cloud workloads) are kind of the point of GraalVM. Effectively, it shifts optimisation to the compile phase. GraalVM build take much more time than classic Java. But they run a bit faster (on some workloads dramatically) and use less memory. It's no silver bullet for development, if you want fast turnaround after changing your code you want the classic JVM. GraalVM can help t…

I haven't noticed compile times to be any worse when using GraalVM to build Java projects. Caveat: I also haven't been using Native Images yet, though. So I can't comment on if it'll be dramatically different for that build target.

GraalVM is multiple projects and I feel there is often a bit of a mix-up around these:

GraalVM is first and foremost a JIT compiler written in Java that can be plugged into OpenJDK. Due to it being written in a higher level language than the original Hotspot compilers (written in C++) they are easier to write/maintain/experiment with. This mode of operation is used extensively by Twitter for example, because on their workloads it provides better performance than Hotspot, but the two trades blows in general. But this uses the standard javac compiler so it is basically just a slightly different JVM implementation.

Since a JIT compiler outputs machine code it can be “easily” modified to do so in an offline setting as well — this is Graal’s AOT/native compilation mode. This will take a long time compared to some other compilers (I don’t exactly know the reason for that, probably Java’s dynamic nature requiring more wide-reaching analysis?), but will have lower memory usage and faster startup speed compared to the traditional execution mode (but rarely better performance).

There is also Truffle, which turns “naive” language interpreters into efficient JIT compiled runtimes and allowing polyglot execution, which is a whole other dimension.

Re: Native Minecraft servers with GraalVM Native Image

#44
post #34

Earlier quoted context omitted.

>Startup are a none issue Yes it is. Developing any short term job -- that runs multiple seconds and goes away -- like lambda or k8s jobs with Java is meaningless for exactly this reason. The startup time is longer than the run time.

The JVM can start up in less than 0.1 seconds. Depending on the amount of classes being loaded it is not an issue even for lambda and k8s jobs.

You clearly did not deploy enough classes on Lambda to have more than 10 seconds warmup on a trivial Java based Lambda function.

Re: Native Minecraft servers with GraalVM Native Image

#45
I don't think this repo provides any value. It compiles only Vanilla server, doesn't provide any benchmarks while spending whole paragraph on GraalVM Enterprise and Oracle Cloud(a single worst cloud experience I've ever had, it took me two dozen attempts to register until I finally gave up) Free Tier promotion

Re: Native Minecraft servers with GraalVM Native Image

#46

Earlier quoted context omitted.

I use GraalVM as my standard non-native JDK (OpenJDK replacement) and I'd say the performance is somewhat better. There are a lot of non-biased benchmarks you can find online, most of them showing that Graal (both CE/EE, though particularly EE) are more performant than OpenJDK. You then also have the option to compile to native, or to embed/run code in other languages baked in. It's a no-lose scenario IMO.

Are there no downsides?

It usually needs a bit longer warmup period in my experience. But for long-running processes it can be ideal, Twitter for example uses it for quite some time in production.

Also, not every GC is available, or only in the enterprise version.

Re: Native Minecraft servers with GraalVM Native Image

#47
post #26
post #14

Earlier quoted context omitted.

This is a Minecraft server, so it's going to be running 24/7.

I see you aren't familiar with modern state of Minecraft servers. Due to Minecraft being limited to a one core big servers actually aren't a single instance. They use proxy servers(such as BungeeCord and it's forks) which distributes load between several lobby servers and from there people join one of custom gamemodes(Skyblock, Bedwars, etc). This allows for tens of thousands of people to play simultaneously, but not…

> And there have been some attempts to make Minecraft to run a single world on multiple instances(MultiPaper and some private ones)

First time I hear about MultiPaper, another idea I had which I din't know someone was already working on LOL. It's a pretty promising idea considering the current performance problems of the game. This could possibly allow thousands of players in the same server which would be AMAZING, almost a completely different game. Imagine if MultiPaper was compiled to native using GraalVM.

Re: Native Minecraft servers with GraalVM Native Image

#48
post #43
post #35

Earlier quoted context omitted.

I haven't noticed compile times to be any worse when using GraalVM to build Java projects. Caveat: I also haven't been using Native Images yet, though. So I can't comment on if it'll be dramatically different for that build target.

GraalVM is multiple projects and I feel there is often a bit of a mix-up around these: GraalVM is first and foremost a JIT compiler written in Java that can be plugged into OpenJDK. Due to it being written in a higher level language than the original Hotspot compilers (written in C++) they are easier to write/maintain/experiment with. This mode of operation is used extensively by Twitter for example, because on their…

Wow, yes this definitely was not clear to me as a (longtime) user of GraalVM.

Thanks a lot @kaba0, big-O would be smart put your comment as part of the GraalVM site FAQ for "What is GraalVM".

Cheers.

EDIT: One request for a small clarification

> But this uses the standard javac compiler so it is basically just a slightly different JVM implementation.

What is "this"? Are you referring to TFA?

Re: Native Minecraft servers with GraalVM Native Image

#49
post #12

Earlier quoted context omitted.

Minecraft Bedrock edition runs better. It has feature parity but is not compatible with java server, and requires a new purchase IIRC.

> Minecraft Bedrock edition runs better. It has feature parity but is not compatible with java server, and requires a new purchase IIRC. That's no longer the case. If you have one, you can "purchase" the other for free. See https://www.minecraft.net/en-us/article/java---bedrock-editi... and https://help.minecraft.net/hc/en-us/articles/6657208607501 for details. Also, there are mods for the Java server which allow bot…

> Also, there are mods for the Java server which allow both Java and Bedrock clients to connect to the same server and play together.

How exactly does that work? Afaik there are quite a few behavioral differences between the two, especially for technical things like redstone and pistons.

Post reply on HN