Posts

Showing posts from 2014

Java JIT Compilation, Inlining and JITWatch

Dr. Srinath  recently shared an InfoQ article with us and its title is " Is Your Java Application Hostile to JIT Compilation? ". I'm writing what I learnt from that article in this blog post. Overview of Just-In-Time (JIT) compiler Java code is usually compiled into platform independent bytecode (class files) using "javac" command. This "javac" command is the  Java programming language compiler . The JVM is able to load the class files and execute the Java bytecode via the Java interpreter. Even though this bytecode is usually interpreted, it might also be compiled in to native machine code using the JVM's Just-In-Time (JIT) compiler.  Unlike the normal compiler, the JIT compiler compiles the code (bytecode) only when required. With JIT compiler, the JVM monitors the methods executed by the interpreter and identifies the “hot methods” for compilation. After identifying the Java method calls, the JVM compiles the bytecode...

Oracle Java Installation script for Ubuntu

Few months ago, I wrote a blog post on Installing Oracle JDK 7 (Java Development Kit) on Ubuntu . It has several steps to install the JDK on Ubuntu. Every time when there is a new version, I upgrade the Java version in my laptop. Since I do few repetitive steps for every Java installation, I wrote a simple installation script for Java. The installation script is available at GitHub:  https://github.com/chrishantha/install-java You just have to run "install-java.sh" with root privileges once you download the JDK from Oracle. It also supports the installation of JDK Demos and "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" Please refer the install-java.sh README at GitHub.  The script supports JDK 7 and JDK 8. Please try the installation scripts and let me know any feedback! :)

Enabling Java Security Manager for WSO2 products

Why Java Security Manager is needed? In Java, the Security Manager is available for applications to have various security policies. The Security Manager helps to prevent untrusted code from doing malicious actions on the system.  You need to enable Security Manager, if you plan to host any untrusted user applications in WSO2 products, especially in products like WSO2 Application Server . The security policies should explicitly allow actions performed by the code base. If any of the actions are not allowed by the security policy, there will be a SecurityException .  For more information on this, you can refer Java SE 7 Security Documentation . Security Policy Guidelines for WSO2 Products When enabling Security Manager for WSO2 products, it is recommended to give all permissions to all jars inside WSO2 product. For that, we plan to sign all jars using a common key and grant all permissions to the signed code by using "signedBy" grant as follows. grant sign...

Java Performance Monitoring Libraries

There is a proposal to  build performance probes in WSO2 Platform . For that I started looking in to some performance monitoring libraries. Following libraries were mentioned in the WSO2 architecture thread. Metrics Parfait JAMon (Java Application Monitor) While looking in to these libraries, I found out about following also. Java Simon - Simple Monitoring API Perf4J Here is a quick comparison of each project. These comparison criteria are based on the requirements in above proposal. Metrics Parfait JAMon Java Simon Perf4J License Apache License 2.0 Apache License 2.0 JAMon License New BSD License Apache License 2.0 Source GitHub Google Code Sourceforge GitHub GitHub Latest Version 3.1.0 0.2.8 2.79 4.0.0 0.9.16 Last Published Sep 4, 2014 Jun 01, 2011 Aug 20, 2014 Oct 29, 2014 Oct 16, 2011 Java Version - Java 6 - Java 7 - Counts Yes Yes Yes Yes No Timings Yes Yes Yes Yes Yes JMX Support Yes Yes No Yes Yes Enable/Disable No No* Yes Yes Yes* * Not ...

Monitoring WSO2 products with logstash JMX input plugin

These days, I got the chance to play with ELK  ( Elasticsearch , Logstash & Kibana ). These tools are a great way to analyze & visualize all logs. You can easily analyze all wso2carbon.log files from ELK. However we also needed to use ELK for monitoring WSO2 products and this post explains the essential steps to use logstash JMX input plugin to monitor WSO2 servers. Installing Logstash JMX input plugin Logstash has many inputs and the JMX input plugin is available under "contrib" We can use "plugin install contrib" command to install extra plugins. cd /opt/logstash/bin sudo ./plugin install contrib Note: If you use logstash 1.4.0 and encounter issues in loading the jmx4r, please refer Troubleshooting below. Logstash JMX input configuration When using the JMX input plugin, we can use a similar configuration as follows. We are keeping the logstash configs in "/etc/logstash/conf.d/logstash.conf" input { jmx{ path ...

"Subversion Native Library Not Available" Error on Eclipse (with Subclipse) Ubuntu

Image
Do you use Eclipse and Subclipse ? Do you encounter following error: "Subversion Native Library Not Available" Now if you go to Eclipse -> Preferences -> Team -> SVN, you will see that "JavaHL (JNI) is Not Available" for SVN interface. The solution is to install JavaHL . After installing, we need to make sure that Eclipse can see the relevant libraries. For that I just created soft links. sudo apt-get install libsvn-java sudo ln -s /usr/lib/x86_64-linux-gnu/jni/* /usr/lib/ Now restart Eclipse and you should be able use Subsclipse with JavaHL.

Why you should attend WSO2Con Asia 2014

WSO2Con Asia 2014 , a must attend conference for anyone interested in WSO2 products, is just around the corner. The WSO2Con Asia 2014 is scheduled from March 24 to March 26 with two conference days and one pre-conference tutorial day. Have a look at WSO2Con Asia 2014 Agenda for all interesting talks and tutorials WSO2 has to offer. The conference will be held at Waters Edge , a popular venue in Sri Jayawardenapura Kotte, Sri Lanka. Here are few reasons I can think of as to why you should attend the WSO2Con. WSO2 is the only company to have a complete set of open source middleware products built from scratch and WSO2Con is a good opportunity for you to learn how we make world-class products. Pre-conference tutorials will help you to get an understanding of how our stuff works. So, don't worry if you do not have much idea about the WSO2 products. See what WSO2 has to offer with WSO2 Mobile subsidiary. Meet the experts. Networking opportunities. Discover how WSO2 sof...

What is WSO2 Private PaaS?

Image
In this blog post, I'm going to briefly introduce the WSO2 Private PaaS , an upcoming product from WSO2. Even though I'm writing about this now, the WSO2 Private PaaS term coined just few weeks after we donated WSO2 Stratos to Apache Foundation in June 2013. Apache Stratos (incubating) and WSO2 Private PaaS The WSO2 Private PaaS is built on top of the Apache Stratos (incubating) project, which is currently undergoing major architectural changes from the initial 3.0.0-incubating version. Following are few major changes you can expect in the next Apache Stratos (incubating) release. i.e. 4.0.0-incubating version. Using a message broker for communication among core Stratos components. Auto scaling now analyze real time data from cartridges like in flight request count and load average. Currently this data is analyzed using  WSO2 Complex Event Processor Load Balancer is now a cartridge in Stratos New Stratos Manager UI Stratos Manager now has RESTful servic...

Installing Oracle JDK 7 (Java Development Kit) on Ubuntu

There are many posts on this topic if you search on Google. This post just explains the steps I use to install JDK 7 on my laptop. Download the JDK from Oracle. The latest version as of now is Java SE 7u51. I'm on 64-bit machine, therefore I downloaded jdk-7u51-linux-x64 .tar.gz It's easy to get the tar.gz package as we just have to extract the JDK. I usually extract the JDK to /usr/lib/jvm directory. sudo mkdir -p /usr/lib/jvm cd /usr/lib/jvm/ sudo tar -xf ~/Software/jdk-7u51-linux-x64.tar.gz sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_51/bin/javac" 1 sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_51/bin/java" 1 sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_51/jre/lib/amd64/libnpjp2.so" 1 sudo update-alternatives --install ...