A while ago the Oracle WebLogic Virtual Edition was announced. This WebLogic server runs on jRockit Virtual Edition (VE), which is a Java VM that runs directly on the hypervisor. The idea is that an OS is not necessary any more, giving the jRockit VE a speculated overhead of only 2MB of RAM.
(Picture taken from this Oracle datasheet).
I don’t know what happened with this product, because finding a download for this software is near to impossible. At the time of writing, the OTN page gives a 404, and Google doesn’t really give you an alternative location. Luckily this blog gives a download link to a Oracle VM image with jRockit VE and WebLogic server 10.3.2. The download contains a Oracle VM config file, the jRockit VE Image Tool and a disc image (system.img).
But what if you don’t want to run WLS on jRockit VE? The official Oracle documentation has an elaborate manual for creating jRockit VE images for Oracle VM. But I got stuck at the point that the jrockitve.bin file is needed during the configuration (I don’t seem to be able to find that on the Oracle site). So I decided to modify the jRockit VE + WLS image to run something else than WLS.
To show how this works I decided to run a default Coherence cache server on jRockit VE on my Oracle VM Server. It is actually quite simple.
First thing to do is to unzip the wlsvePackage. After this, we need to get the jRockit VE configuration.
(In my examples I assume a Linux/Unix environment).
$JAVA_HOME/bin/java -jar wlsveimagetool.jar -r ./wlsve/vm.cfg get config config.xml
This is the config we will later change and apply.
Next we will look inside the system.img and put our own Java software on it. First we mount the system.img file in /mnt/sysimg. Run as root (or use sudo):
# If the mount directory doesn't exist: mkdir /mnt/sysimg mount -o loop=/dev/loop0 system.img /mnt/sysimg
If we now go to the /mnt/sysimg directory, we see (among others) a jrockitve, boot, and application directory. This application directory contains the WLS server. So get rid of this one.
sudo rm -rf /mnt/sysimg/applications
Now download Oracle Coherence, and unzip it in /mnt/sysimg so that there is a coherence directory with the required Coherence library (make sure /mnt/sysimg/coherence/lib exists for example). We don’t need anything more, because we will use the default Coherence cache server.
In the next step we will configure the jRockit VE and run the VM. First we need to unmount the system.img. As root:
cd umount /mnt/sysimg
(Ignore the message about the loop device).
Back to the config.xml we created earlier.
<?xml version="1.0" encoding="UTF-8"?> <jrockitve-imagetool-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="jrockitve-imagetool-config.xsd" version="5.1"> <jrockitve-config memory="128" cpus="1"> <storage> <disks> <disk id="root" size="256 MB"/> </disks> <mounts> <mount> <mount-point>/</mount-point> <disk>root</disk> </mount> </mounts> </storage> <vm-name>jrve_coherence</vm-name> <working-dir>/</working-dir> <java-arguments>-cp $JAVA_HOME/lib/tools.jar:/jrockitve/lib/common.jar:/coherence/lib/coherence.jar -Dtangosol.coherence.clusterport=5555 com.tangosol.net.DefaultCacheServer</java-arguments> <network> <nics> <nic type="bridged"/> </nics> </network> <locale-data> <locale>en_US</locale> <timezone>Europe/Amsterdam</timezone> <encoding>ISO-8859-1</encoding> </locale-data> </jrockitve-config> </jrockitve-imagetool-config>
Note that I changed the memory this VM can take (128MB), I set the disc image to 256MB, updated the working dir (/) and set the Java command to start the default cache server.
The config has now to be set in the VM using the Image Tool:
$JAVA_HOME/bin/java -jar wlsveimagetool.jar -r ./wlsve/vm.cfg set config config.xml
Note that the disc image has shrunk! A word of warning: I don’t actually know how intelligent this wlseimagetool.jar is in shrinking images. Maybe the Linux tool resize2fs is a better way. Anyway, in this simple testcase it works.
Now copy the system.img and vm.cfg to your Oracle VM Server (for example to /OVS/running_pool/jrve_coherence). Edit the vm.cfg to set the “disk” option to reflect the path of system.img.
Now start it up!
xm create -c vm.cfg
The VM will start, and the Coherence default cache server will run. It will run on jRockit VE, which runs without OS directly on the hypervisor. And that is awesome!
Of course running Oracle Coherence is just an example. Naturally you can run your own Java applications.