Hacker News new | ask | show | jobs
by ushakov 1421 days ago
> “Lightweight”

> written in Java

seems like a contradiction, no?

edit: thanks for explaining me why this is not the case

5 comments

Not at all. Java the language is not heavyweight (your smart cards and sim cards run Java code inside them!), and the regular JVM can run on pretty low resources.

It's the frameworks and architectural decisions that make Java software feel heavy or light. Very much like with JavaScript, for instance.

Back at some previous job, we ran a lot of small services written in Java; a service consuming 50 MB of heap was considered unusually heavy.

Besides git, OneDev only has one JVM process which actually saves resources compared to other products packaging dozens of processes.

In future, I will explore graalvm (or Jave native) to further reduce resources.

Java unfairly has been given a bad rep since its earlier versions (similar to how PHP still is tainted by its SQL injection vulnerabilities pre PHP7)

Java as you know is translated into byte code and then it is up to the compiler to use JIT compilation when running the code. JIT allows flexibility to choose how to optimise linkers and references to other libraries which means that it can choose how to optimise the code after Run 1, 10, 100. Some Java VMs can decide to optimise "fast startup" vs "fast runtime".

This is a nice flexibility and with Java maturing into Java 17 there are more and more optimisations on the horizon for VMs, GC and precompiling dependencies.

Lighter than Ruby or Python.
I've always thought like you... Until using OneDev.

For me, Java was : - slow and heavyweight - dist directory often a fucking mess

OneDev distribution (docker container or zip for baremetal) is clean and very well organized. There are running scripts for both plateform linux/windows. Fast.