Azul gets asked frequently whether Zing–which is a by design a great production JVM on the server–would also satisfy a developer use case for Java applications. Typically, this means putting Zing onto a laptop or desktop and running developer IDEs and tools.
Fortunately, several factors are converging to make Zing in development easier than traditionally remoting in to the server. The first is wider proliferation of Intel processors with VT-x into desktop and laptop machines. The second is a recent round of product changes to ensure Zing fits into the same CPU and memory resource profile as common Hotspot-based JDKs. The third is a recent round of experiments to prove Zing works not only as a production server JDK, but also as a desktop JDK for IDEs like the Eclipse JDT workbench and IntelliJ IDEA.
Finally, we can break the barriers to running Zing on both Windows and Mac by using hardware-supported virtualization on the desktop, for example Oracle VirtualBox. A desktop virtual machine may not be suitable for extreme low latency qualification or carrying production loads, but for many development and QA tasks, using Zing as a local JDK with no GC pauses and scalable memory to match downstream production Zing deployments completes the life cycle picture.
Azul will cover this topic in a multipart-part series. In this first part, we show a recipe for success in setting up Zing inside a virtualized guest OS for desktop execution on Windows and Mac. In the subsequent parts, we will show how to setup common IDEs like IntelliJ IDEA for developing applications with Zing.
Step One: Ensure your system uses Intel or AMD x64 processors with VT-x or AMD-V enabled. We used a Lenovo T460s and a Mac Book Pro. Most modern laptops come with this feature enabled, but on some machines, you may need to boot into the BIOS to switch it on. If you are not sure download this tool from Microsoft to check.
Step Three: Add the VirtualBox Extension Pack. Without the extension pack, I could not create 64-bit guest OS targets, so this is a necessary step. (File -> Configuration -> Extensions)
Step Four: In VirtualBox, create a new Linux 64-bit guest OS virtual machine.
We recommend starting with CentOS 7.3 (1611) prepared from osboxes here: http://www.osboxes.org/centos/. (A raw CentOS installation works but requires some additional kernel settings.) Choose Linux and CentOS 64bit as targets and select the downloaded “.vdi” file as “Existing Disk”.
Before booting CentOS make these VM Settings changes:
- 8 GB of RAM of more is recommended
- 2-4 or more CPUs as the Zing garbage collector runs concurrently
- In “Display” set memory to 128MB and active 3D acceleration (we will be running IntelliJ IDEA in the next series blog)
- Check System -> Acceleration for activated VT-x and Nested Paging
- Configure the network interfaces.
- NAT (for Internet access) is pre-configured as Adapter 1
- Configure Host only (for local networking) as Adapter 2 (not required but useful)
Step Five: Boot CentOS
- Check the kernel version with
cat /proc/versionand compare with the list of supported kernels from the Zing System Requirements Guide.
- You may want to change your keyboard: Applications -> System Tools -> Settings -> Keyboard -> Input Sources
sudo yum update
Step Six: Install Zing. I used the Zing trial system at www.azul.com/zingtrial, following the instructions for CentOS and its Yum command set here. After connecting to the Azul Yum repo, issue the install command:
sudo yum install zing-jdk1.8.0-trial
The same process works for other Linux distros. Just use the quick start guide for your particular distro, whether for Red Hat, SLES, using RPM package manager commands or Ubuntu, Debian, etc using DEB package manager commands, respectively.
Step Seven: Obtain and install a valid license for Zing. I used the license from the Zing trial. After registering I got my passcode and executed the following command
sudo zing-obtain-trial-license -p TrialLicensePasscode
Step Eight: Run Zing!
Zing gets installed into /opt/zing/zing-jdk8-trial, so you can set this as your JAVA_HOME environment variable, and then add $JAVA_HOME/bin to your PATH. Then execute ‘java’ and ‘javac’ commands just like any other JDK.
Any other tool that relies on JAVA_HOME to locate the JDK is now enabled. Zing provides its own JDK tools like jConsole and Zing Vision, though common development tools, frameworks, application servers, and agents that honor JAVA_HOME that you add to the guest OS Linux instance should work from this point.
Why this Works
Zing consist of two components, the ZVM which provides the Java Runtime Environment, and the ZST which provides a set of system tools needed to host the Zing ZVM on top of the specific version of the underlying Linux kernel. The combined Zing ZVM and ZST running inside the guest Linux OS meets the Zing system requirements, courtesy of the hardware-based virtualizer. Oracle VirtualBox is one such valid choice, though VMWare Fusion also works.
To be pedantic, Zing works on many virtualized platforms, but not all. In general Hardware-assisted Virtual Machine (“HVM”) configurations based on Intel VT-x enabled HW works well and is supported by Azul for all Linux OS versions also supported. That means Amazon EC2, Azure, and Oracle Virtual Box virtual environments configured with Intel VT-x running a supported Linux OS and configured within other Zing system minimum levels remains valid under the Zing support matrix.
Xen Paravirtualization mode is not supported, as, for example, offered as an option for some Amazon EC2 instances. In general, paravirtualization techniques modifying the Linux kernel memory management are not supported.
As Zing uses virtual memory mapping techniques extensively, only HVM instances are supported. Specifically, virtualization using Intel VT-x Extended Page Tables (“EPT”) or AMD-V Nested Page Tables is supported. Virtual machines based on standard Linux Kernels (since 2.6.23) using KVM Paravirt-Ops are supported.
Holger Isenberg of Azul validated VMWare Fusion on his Mac running a Ubuntu guest OS
Michael Roeschter of Azul validated Oracle VirtualBox on Windows running a CentOS guest OS.
Matt Schuetze of Azul validated Oracle VirtualBox on his Windows laptop running a Ubuntu guest OS.
Next In Series
In a future article in this series, we will put together a recipe using IntelliJ IDEA with Zing for common development tasks.