So I made this presentation for a "tech talk" at work, but it was really to help myself better understand JVM applications - how they run and if we should use containers.
I'm pretty new to Java, so a part of this is on how the JVM works - and comparing Scala to other languages.
I posted the full video here (25 mins) but the slides are below with some notes.
Hopefully someone finds this useful. If you see any errors, or glaring omissions, please let me know.
1. JVM languages (like Java and Scala) are similar to other scripting languages (like Python and Javascript) in how it is run.
2. Hypervisors (like Virtual Box) allow another operation system to run on top of your computer.
3. The type of hypervisors that cloud providers (like AWS) use are installed directly on their hardware, but are similar to Virtual Box.
4. Containers are a native Linux feature that uses "namespaces" and "cgroups" to manage isolated processes.
5. VMs tend to be a lot larger than containers because they include the operating system.
6. Containers can potentially better compute efficiency because they are able to share the same kernels.
7. The JVM did not "support" containers until 4 years after Docker was released. Java is still seen as
8. The JVM requires a different standard C library than the one packaged by Alpine (the most popular Linux distribution with containers).
9. In conclusion ...
Top comments (2)
The Java "container" support was a fix for the Runtime to return the effective resource (RAM/CPU) sizes when they were set via the Linux cgroups feature. Originally it returned the system values. This would have some side nasty side effects if you did not also tune the JVM parameters. So it's not actually container support, but rather a fix for system resource limits.
Which means that if, for example, you mange your Java application via Linux' systemd you can also limit the max memory and CPU via the systemd specification for that service, and the Java instance will properly pick it up.
I don't get picture #6. It makes it seem like you can only run a single Java process per system. Java programs are much more self contained than for example Perl/Python/NodeJS/... You can easily install multiple different Java versions on the system system running various Java programs with different dependencies. They won't bite each other.
Thanks...sounds like a plan....