A
Admincraft6mo ago
gero

Why is there no server software making use of the JNI/FFI?

When it comes to server software, 99% is based on the vanilla minecraft server. There are efforts to rewrite it completely (feather_rs, valence, ...), but not a single one achieved feature parity with the vanilla version. In Java, there is something called the JNI which allows the JVM to call natively compiled code (written in some other programming language e.g. C, C++, Rust, Zig, ...) and therefore could offer huge performance advantages over the existing java code. Isn't that an opportunity to rewrite very specific, computing intense functions with the use of JNI/FFI and achieve a much more performant server software? I'm not at all familiar with JNI or FFI and I'm sure there is a simple answer to this (No speed advantage? Cross-Platform compability? Too complex?).
7 Replies
Admincraft Meta
Admincraft Meta6mo ago
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close !close !solved !answered
Requested by gold.ly#0
Jenkins
Jenkins6mo ago
What you're saying is sadly wrong JNI has extreme overhead It will cause major slowdowns, it won't make anything faster Not only is JNI too complex, it will also cause compatability issues yes You'd have to recompile the native binaries for every OS and architecture
gero
geroOP6mo ago
Thanks for your answer. It's really hard to imagine that JNI is even slower than some of the heavy functions in vanilla etc and here (https://stackoverflow.com/questions/7699020/what-makes-jni-calls-slow) they claim the call isn't that slow (or is it something else than the call itself?).
Stack Overflow
What makes JNI calls slow?
I know that 'crossing boundaries' when making a JNI call in Java is slow. However I want to know what is it that makes it slow? What does the underlying jvm implementation do when making a JNI cal...
Jenkins
Jenkins6mo ago
They are slow Even if they aren't “that” slow, it'd still be slower than the current implementation
gero
geroOP6mo ago
Thanks anyways 🙂
auby
auby6mo ago
security, bypassing most of the JVMs current optimisations, only useful for certain operations, needs to be compiled per platform, debugging JNI stuff isn’t fun security is one that people don’t tend to realise noting JNI bypasses the JVM’s security model completely
Admincraft Meta
Admincraft Meta6mo ago
post closed!
The post/thread has been closed!
Requested by gold.ly#0

Did you find this page helpful?