Vert.x native: how to run a JVM app in 10Mb of RAM
jetdrone.xyz
jetdrone.xyz
What do I need to have a simple "hello world" CLI Java app which starts within 25ms and doesn't eat more than 10MB of RAM? Is GrallVM enough?
Yup. Here is another tutorial [1]. There are limitations, though:
* It's AOT, which means you don't get the JVM peak performance that come from JITting to your wordload profile. (but maybe in the future we can have startup in AOT then transition to JIT?)
* You're getting an embedded generational garbage collector. Not the sweet stuff like G1/ZGC/Shenandoah.
* You can't do dynamic class loading, or you have to declare (and know) beforehand which classes are reachable. A fair amount of frameworks use this and will not work with native-image. I suspect these will provide mechanisms to help in this regard in the future (for JSPs: generating the code of all classes-pages that are reachable at compile-time).
* There are other limitations [2].
All in all, great for CLIs and cloud lambdas.
[1] https://medium.com/graalvm/instant-netty-startup-using-graal...
[2] https://github.com/oracle/graal/blob/master/substratevm/LIMI...
A talk about HotSpot AOT: https://youtu.be/n5DCg6M2MDM
Origin of the term here: https://www.reactivemanifesto.org/
Graal is an R&D effort by a few folks in the java community driven by oracle right now to allow AOT compilation among other things for the JVM: http://www.oracle.com/technetwork/java/jvmls2015-wimmer-2637...
Java is generally not for apps that require fast VM spin up times. That being said, for what the JVM ecosystem can do it isn't bad in practice for heavy server applications.
I know gravitational mainly works in the go ecosystem which has its own trade offs there, but considering what else java already has a mature ecosystem for (big data, well understood native internals, other language built on top of it) the startup times and weaknesses while not ideal haven't been a show stopper.
GraalVM is an attempt to address a wide variety of problems you get with JVM startup time, GC etc.
At most it's simplistic right now and will be for a while. The fact they are working on it is really cool though!
Hope that helps!
Graal compiles JVM bytecode to native code, so that's the critical factor for your CLI app use case. You'd only need Vert.x if you were writing a server.
I thought u were talking about big data spark. But I think you are talking about http://sparkjava.com/
Vert.x is nothing like Spring Boot. Spring Boot combines Spring with autoconfiguration and the ability to run in its own container. Spring Boot can run on Undertow which the other branch of JBoss marketing promotes a lighter weight than Netty.
> Not Spring Boot. Spring Boot is a framework for implementing a server side application.
'server side application' and 'server' or 'web server' are two terms for the same thing in many people's vocabulary. You two are arguing at cross-purposes.
To my knowledge Vert.x and Vert.x web have no equivalent to Spring Boots autoconfiguration.
I am not saying Vert.x or Vert.x web are worse than Spring Boot but they do very different things.
I have actually been surprisingly happy with my initial experience with Micronaut. It is clearly engineered as a next-generation framework where all the defaults are set to exactly what you want to build small microservices right from the start. I am using Groovy and it still starts up in ~ 1 second with minimal memory use.
[2] https://jaxenter.com/micronaut-framework-microservices-14245...
This seems to be the right way to do things in Java to me since I learned about Dagger https://github.com/google/dagger
Using Unifi Controller in Docker right now, uses 300 MB for Java (OpenJDK 1.8 x86-64) and 63 MB for Mongo DB. Haven't compared with UNMS though which needs to run in an Ubuntu 16.04 VM.
Would love to see them reduce the overhead of the controller, but to be honest, traditional IT managers will probably just spring for the $100 cloud key and be done with it.
Oh, and that $400 AP is slower than the Turris Omnia that it was replacing - and that was doing 4x gigabit switching at the same time.
What part? The Unifi controller software is not for "a device", it's for multiple devices, imagine having to manage SSIDs / auth for primary+guest Wifi network across just 5 access points. I don't think anyone would enjoy logging into 5 separate AP UIs. Add your Unifi gateway + switches to that and the need to have a unified control plane is pretty obvious.
If you want self-contained, that's a separate product line, usually prefixed with "Edge". What's "infuriating" about having two product lines I don't understand. Honda makes motorcycles, boat engines, cars and jets and nobody gets pissed about it.
> there are several lines that can’t be managed from the same control plane.
They really mean "10 MB" as in 10 Megabytes.
Performance is usually way better than any Spring-driven app.