A couple of days ago a new Debian based distro for the pi was released called Raspbian “wheezy” was released and is now the official Raspberry Pi Debian distro (I believe). This is the first OS release for the Pi to take advantage of the Pi’s floating point hardware, which is going to make the OS a lot faster for general use. I downloaded it for testing in my rig, sadly this is a tale of woe.
Apache Cassandra is a Java application and needs a JRE in order to run. I’ve always used a Oracle supplied JVM “Oracle’s java SE for embedded “
http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html
Sadly, it seems this can’t be used on Raspbian. Trying to run it gives :
Java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
It seems that this version of Java uses the “soft float ABI (armel) which is incompatible with Raspbian”: (thanks to mpthompson on the Raspberry Pi forum for the information) so it’s looking like it can’t run. Back to openjdk ?
But wait ! Why did I not use openjdk in the first place ?
That’s simple, performance. In my experience (and perhaps this is a configuration problem I’m not aware of) Open JDK is a lot slower than the Oracle version. And I mean a lot slower! I set up a single node Cassandra server image, one with the old Debian image and Oracle Java the other with Raspbian and Open JDk. I then ran stress tests from a Apple Air (something I’ve done many times !) . Here’s the results. The second column is interval_op_rate, you want this to be as high as possible, the third column is avg_latency, you want this to be as low as possible.
Raspbian and OpenJDK
>Lifeintheairage:bin Administrator$ ./stress -d 192.168.1.12 -o insert -I DeflateCompressor
Unable to create stress keyspace: Keyspace names must be case-insensitively unique ("Keyspace1" conflicts with "Keyspace1")
total,interval_op_rate,interval_key_rate,avg_latency,elapsed_time
485,48,48,0.8705896907216495,10
1042,55,55,0.9123070017953321,20
1436,39,39,1.2947030456852793,30
2010,57,57,0.9009128919860627,40
2510,50,50,0.961294,51
2743,23,23,1.922206008583691,61
3306,56,56,1.0665861456483126,71
3863,55,55,0.9055601436265709,81
4118,25,25,2.0272901960784315,91
4659,54,54,0.9333364140480591,102
5031,37,37,0.916733870967742,112
5498,46,46,1.480710920770878,122
Debian Squeze and Java SE for embedded
>lifeintheairage:bin Administrator$ ./stress -d 192.168.1.10 -o insert -I DeflateCompressor
Unable to create stress keyspace: Keyspace names must be case-insensitively unique ("Keyspace1" conflicts with "Keyspace1")
total,interval_op_rate,interval_key_rate,avg_latency,elapsed_time
2565,256,256,0.18891695906432748,10
4604,203,203,0.2503182932810201,20
7093,248,248,0.20536078746484532,30
9289,219,219,0.23249635701275045,40
11516,222,222,0.22830354737314773,51
14107,259,259,0.19691161713624084,61
16297,219,219,0.22646849315068493,71
18092,179,179,0.29083064066852365,81
19756,166,166,0.30374939903846154,91
21689,193,193,0.2648339368856699,102
23404,171,171,0.18766355685131195,112
25395,199,199,0.3459779005524862,122
27646,225,225,0.2330964015992892,132
29684,203,203,0.24136898920510305,142
And a graph of interval_op_rate:
(red is Java SE for embedded, blue is OpenJDK)
Java SE for embedded really is a lot faster for Apache Cassandra (and I wouldn’t be surprised for other java apps such as Arduino IDE). For now I need to stick with the Debian release, I hope it doesn’t become unsupported. Hopefully someone can get in touch with Oracle and encourage them to support a official port of Java SE for embedded onto the raspberry which supports the correct Raspbian libraries.

This comment has been removed by the author.
ReplyDeleteHi Andy, thanks for the writeup on this issue. Agree that it seems to be 'back to Debian' for now...
ReplyDeleteOnce you've used an Oracle JRE, its difficult to accept anything else... the figures don't lie!
Hopefully we can encourage Oracle to produce an armhf compatible JRE binary.
Chris
Did you use openjdk's java with the -cacao flag? I'm just starting to experiment with java on the rpi but running a simple benchmark did show an improvement using cacao's jit rather than the stock jvm.
ReplyDelete@ksclarke, yes I've experimented with the -cacao flag. There is a small improvement but not great compared to the oracle JRE
ReplyDeletehi, i have a problem when i install jdk on debian, i prefer oracle jdk to openjdk. I download jdk from oracle web, i extrac it, create symlink and modify .bashrc, but when i try to use command java, javac etc, the console shows "cannot execute binary file".
ReplyDeleteCan help me. thx.
I've not seen that error. Did you download Java SE Embedded 6
ReplyDeleteARMv6/7 Linux - Headless file I think is ejre-1_6_0_32-fcs-b05-linux-arm-vfp-eabi-headless-05_apr_2012.tar.gz ?
Thank very much, at the end, I deleted all and reinstall for fifth time jeje, now it works xD, when I write java -version command in console, shows ->
Deletejava version "1.6.0_32"
Java(TM) 2 Runtime Environment, Standard Edition for Embedded (build 1.6.0_32-b05, headless)
Java HotSpot(TM) Embedded Client VM (build 20.7-b02, mixed mode)
I thought with embedded jdk i could compiler *.java archives, but only is the java command.
If need javac command, Where or with What could I execute javac command?
@andrea nope the JRE won't compile java programs for you. It's the run time environment. However you can use openjdk on the Pi to compile your code and run it und er the Oracle JRE. You can of course also write and debug on a desktop machine and just deploy the class or jar files to the PI.
ReplyDelete@Andy C a lot of thx for all help, I installed openjdk and configured command java with the oracle embedded, i now i can compile :).
DeleteThank you very much.
Hi Andy. Thanks for clearing this out, this information was exactly was I was looking for! I have been trying the OpenJDK with very bad performance. Is it possible to find a ready-made image for RaspberryPi of the Debian release you are using? Where and how can I find that?
ReplyDeleteI've asked on the Raspberry pi forum for them to put the Debian image back on line for us java users http://www.raspberrypi.org/phpBB3/viewtopic.php?f=24&t=13038 . If nothing happens contact me on twitter @andycobley
DeleteI think the original debian release might be http://downloads.raspberrypi.org/download.php?file=/images/debian/6/debian6-19-04-2012/debian6-19-04-2012.zip
DeleteThis comment has been removed by the author.
DeleteAndy, I just tweeted you, but just in case, I'll put here the link to all the flavors of Raspi distributions: http://elinux.org/RPi_Distributions
ReplyDeleteHope is what you were looking for!
Regards,
@jmrunge
Great !
Deleteya i am agree with comments web site Design Company
ReplyDeleteI had spent a good deal of my time looking for someone to explain this subject clearly and you’re the only one that ever did that.Keep it up.
ReplyDeleteEcommerce Website Development
Thanks ! for sharing this wonderful news with us.I really like your post as it is informative as well as interesting but I am also quite interested to see your upcoming post for web development
ReplyDeleteso please keep writing.
This is very good
ReplyDeletehref="http://www.us-creations.com/showcase.htm
The java is infact a powerful tool and its performance is far better than other languages but most common language for the Web Development Services is PHP , as due to its felxiblity and open source.
ReplyDeleteHi, I went through your this post and found
ReplyDeletereally interesting. I landed this page through
internet search and found
this page very good.I am a web designer and
works in a web design
company
as a designer I liked the color of your blog
also.
Thanks,
rehan
Thank you for posting such a useful, impressive.your blog is so beautiful. you have give me great news.
ReplyDeleteInternet Marketing Company Bangalore
Hey thanks for sharing....Ideally I was not aware of this concept but you helped me a lot in uplifting my knowledge on Openjdk. This was really helpful for me.
ReplyDeleteWeb Application Development Company India
Hey!
ReplyDeleteWhat a commendable work you have done, with simplest of language. I can’t resist myself to leave a comment and trust me it’s hard to impress me. Even though the title of your blog is very short but still it is catchy enough to manages the attraction at first sight and conveying the gist of the whole matter.
Vachel
.NET Development Chicago
PHP Developer Chicago
cmscentral.net