Plumbr now verified to work on Jelastic
Modern technology is wonderful. Looking back to the early 2000’s, it seems ridiculous. We literally had to wait for months to get our hands on a new staging environment. Young developers, you should be grateful for virtualization and IaaS! You can now get happily up and running on a brand new application server within minutes. Or, so the platform providers promise.
We wanted to test this promise and see whether it’s really that easy to build a virtualized environment. And, of course, run our very own Plumbr leak detector on it. So, we looked for the best PaaS around and found Jelastic. Jelastic is a cool service where you can setup Tomcat, Jetty, or Glassfish with MySQL/Postgres or NoSQL. In minutes! Jelastic also comes with all the other bells and whistles you might need: load balancing, auto-scaling, SSL, and what not.
When we visited http://jelastic.com, we realized we can choose from many different hosting service providers such as Dogado in Germany, ServInt in the US, and Layershift in the UK. I guess Jelastic does not provide the underlying IaaS, but builds a PaaS on top of the existing providers. After rolling the dice, we decided to sign up with Layershift.
It was easy, I must admit. All I had to do was submit my email address and, a few seconds later, I received an email with a password to access my trial account. During the trial period, you face some limitations which appear to be hosting provider dependent. In our case, the only limitation that might concern us was the amount of heap available. Jelastic’s billing model is based on “cloudlets;” a cloudlet is the equivalent of 128MB of RAM and 200MHz of CPU (I wonder how the CPU limitations are implemented). During trials, you have access to a maximum of 16 cloudlets, which limits your total available heap to 2GB. If you are running your apps on larger heaps, you might not be able to test the service before you decide to use it. Otherwise, it seems like a fair model to help you decide whether Jelastic is suitable for your needs.
After receiving the trial account password at the email address provided during registration, you are free to authenticate and check out the environment administration console. It looks like this:
In the screenshot above, I have created a new Jelastic environment. Just as they promised in their getting started guide, I had the environment set up with only a few clicks. I selected Tomcat 7 as my application server.
A quick test showed that my brand new Tomcat was up and running with the public URL provided. The next step was to deploy an application to it. In my case, I chose the WAR file we ship with the Plumbr distribution package to demonstrate the leak discovery process. Again, following the few steps described in the Jelastic tutorials, I deployed my application into the newly created Tomcat instance.
The next step in my quest would take me off the beaten path. I needed to add a java agent named Plumbr to a JVM that was running somewhere in the UK. A little Googling luckily revealed that I was not the first one to attempt it. All you need to do is follow the next steps:
- Open the application server configuration and upload the plumbr.jar file to the /home/ folder as seen in the screenshot:
- Plumbr also needs binaries to gather data from the JVM, so you must add the right binaries. As Jelastic is running on 64-bit linux, the file you need to upload is the lib/linux/64/libplumbr.so file within the Plumbr distribution. Upload it to the same /home/ folder.
- After you have successfully uploaded both files, find the /home/server/variables.conf file and specify the location of the javaagent and the agentpath variables to –javaagent:/opt/tomcat/temp/plumbr.jar and -agentpath:/opt/tomcat/temp/libplumbr.so respectively. The configuration is visible in the next screenshot. Note that the paths specified do not point to the sandboxed /home/ but to the /opt/tomcat/temp/ instead. Not too intuitive, but I guess they have a good reason for this.
Next, let’s check whether Plumbr was successfully attached. The easiest way to do this is to check your Tomcat logs. Navigate to the /catalina/catalina.out file, and you should see a banner similar to the following in the log file:
**************************************************** * Plumbr (2.0) is attached. * * Running with JRE from /usr/java/jdk1.7/jre * ****************************************************
Cool! Let’s see whether the application contains some leaks!
As you might already know, Plumbr gathers statistics about object creation and destruction in your JVM, and then analyses these stats. It uses machine learning to discover patterns in your objects’ lifecycles that allow it distinguish potentially leaking objects from the normal ones. For Plumbr to find the suspects, we need to equip it with data.
In my case, I launched the load tests packaged along with the Plumbr demo application. After about five minutes of runtime, Plumbr notified me (via the email I used to register), that memory leaks had been found. The leak report was attached to the email, but can also be found in your Jelastic environment, in the reports folder as seen in the screenshot.
That’s it! We’re done with the tests. We created a brand new application server instance, deployed an application, and attached Plumbr as a javaagent. Plus, we found a leak in the application. All this in 30 minutes or less, including a little bit of Googling. Not bad.
So what can be considered to be the most frustrating part? Most likely the 1 mbit uplink which made uploading larger files a bit painful. But, I guess it’s not up to the Jelastic guys to provide decent bandwidth to Estonia. Otherwise, we must congratulate the Jelastic team; the speed at which we were able to get our application up and running was really impressive!
Summarizing this process in this article took a lot longer than actually doing it. So, I’d say go ahead and get your 14-days trial from http://www.jelastic.com and try it out yourself.