23 June 2012

JBoss EAP 6 as light as Raspberry PI?

JEE != Heavy!

There has been a lot of debate about JEE application servers being "heavy-weight" . However I've always been of the opinion that JEE app servers may have been a little fat in the "noughties" but with the new breed of application servers combined with JEE6 that is no longer true. So I recently received my Raspberry PI, a cheap ($25) Linux compatible ARM bare board which runs Debian. The PI comes with 256Mb RAM on board and an ARM1176JZFS and supports Java so it should be about as lightweight as you can get as a server platform. Also JBoss EAP 6 was released this week with claims that it is a lightweight JEE6 compliant application server so I decided to test how lightweight it is by getting it to run on the PI.

Install Java

First things first. I decided to use Oracle's embedded Java as it supports Armv6 chips. The exact version used was ejre-7u4-fcs-b20-linux-arm-vfp-client_headless-12_apr_2012.
pi@raspberrypi:~$ gunzip ejre-7u4-fcs-b20-linux-arm-vfp-client_headless-12_apr_2012.tar.gz
pi@raspberrypi:~$ tar xvf ejre-7u4-fcs-b20-linux-arm-vfp-client_headless-12_apr_2012.tar
pi@raspberrypi:~$ cd ejre1.7.0_04/bin pi@raspberrypi:~/ejre1.7.0_04/bin$ ./java -version java version "1.7.0_04-ea" Java(TM) SE Runtime Environment for Embedded (build 1.7.0_04-ea-b20, headless) Java HotSpot(TM) Embedded Client VM (build 23.0-b21, mixed mode)
That's it for installing Java.

Get JBoss EAP 6 Running


 Now for JBoss EAP 6. I downloaded the EAP 6 zip file release from http://access.redhat.com and copied it over to the PI using SCP.

pi@raspberrypi:~$ unzip jboss-eap-6.0.0.zip 

So now we have JBoss "installed". First things first JBoss EAP 6 sets its java memory settings a little high so we override it by setting our own JAVA_OPTS variable and tell JBoss where to find Java. Then we need to add a user so we can access the console later (by default JBoss has no users created).

pi@raspberrypi:~/jboss-eap-6.0/bin$ export JAVA_OPTS="-Xmx125M -XX:MaxPermSize=50M -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml" pi@raspberrypi:~/jboss-eap-6.0/bin$ export JAVA_HOME=/home/pi/ejre1.7.0_04/
pi@raspberrypi:~/jboss-eap-6.0/bin$ ./add-user.sh
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : admin
Password :
Re-enter Password :
The username 'admin' is easy to guess Are you sure you want to add user 'admin' yes/no?
yes
About to add user 'admin' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'admin' to file '/home/pi/jboss-eap-6.0/standalone/configuration/mgmt-users.properties' Added user 'admin' to file '/home/pi/jboss-eap-6.0/domain/configuration/mgmt-users.properties'
Is this new user going to be used for one AS process to connect to another AS process e.g. slave domain controller? yes/no?
no
pi@raspberrypi:~/jboss-eap-6.0/bin$ ./standalone.sh -b 192.168.0.81 -bmanagement=192.168.0.81


With these settings JBoss starts up in about 60 seconds and listens on 192.168.0.81 (the IP address of the PI on the network). Browsing to the home page http://192.168.0.81:8080 we see that JBoss is ALIVE on the PI.

 Browsing through the Admin Console we can see that we have JBoss running with memory to spare!

Why is this important

This may seem a bit silly but it shows that modern JEE 6 application servers are in no way heavyweight and you can easily run a full JEE6 stack in less than 100Mb of RAM on a $30 ARM board. So forget the heavyweight claims.
The second things this shows is that thanks to Oracle's release of the embedded JDK for ARM which is a full JDK as opposed to a mobile profile it is possible to run very complex Java applications on low powered ARM chips ( the PI apparently draws less than 3W power when running flat out). I can see a huge future in new server platforms containing large numbers of ARM chips running application servers like JBoss. In fact I know that Dell and HP are planning these hyperscale servers.











If you enjoyed this post, why not subscribe to our feed?


Enter your email address:



6 comments :

  1. I tried something similar but it did not work, what I want to do is run jboss 5.1 under the rapsberry pi, but I get this message:

    Error occurred during initialization of VM
    Server VM is only supported on ARMv7+ VFP

    Any clue?

    Bets regards.

    ReplyDelete
    Replies
    1. Without checking you may have -server specified in your JVM args in the run.sh or run.conf for JBoss if so try switching to -client.

      JBoss 5.1 is a little heavier out of the box than EAP 6 so you might also have to knock down the -Xmx and hope!

      Delete
  2. Hi,

    can't get the file from redhat, seems like they removed it?
    So I got the 6.0.0 Final vom jboss.org
    there is no add-user.sh shell script in the bin folder...

    BR

    ReplyDelete
    Replies
    1. Hi,

      Confusingly JBoss 6 from JBoss.org is not the same as JBoss EAP 6. JBoss EAP 6 is based on JBoss 7 from JBoss.org!

      Try http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip

      Thanks

      Steve

      Delete
  3. I tried this with ejre1.7.0_45.

    I get Version information but when I try to call add-user.sh or standalone.sh i get permission exception or in case with sudo command not found.

    I also added the JAVA_HOME and JBOSS_HOME to /etc/bash.bashrc but that won't help.

    Any idea?

    Kind regards,
    christopher

    ReplyDelete
  4. slightly late answer but are you in the $JBOSS_HOME/bin directory when you run add-user.sh. If not do
    cd $JBOSS_HOME/bin

    Steve

    ReplyDelete