Accelerated Development and Management

Dude, where's my PaaS memory? Tuning Java's footprint in OpenShift (Part 1)

Is Java really greedy for memory?

Java is often blamed for being an over-hungry consumer of physical memory. Indeed, until recently our OpenShift team were tempted to draw this same conclusion. OpenShift is Red Hat’s open source Platform as a Service (PaaS) product. You can access it via public Cloud infrastructure managed by Red Hat (OpenShift Online) or even deploy it to your own data centre/private cloud (OpenShift Enterprise). OpenShift Online provides simple and manageable scalability to anyone developing and deploying web services. One of the OpenShift team’s goals is to maximize the number of guest Java EE deployments on any underlying physical host. However, in the first release of OpenShift meeting this goal was challenged by the high physical memory use observed in many of the deployed JVMs. With only so much memory available on any given physical host the more memory each JVM uses the lower the density of guest deployments.

Continue reading “Dude, where's my PaaS memory? Tuning Java's footprint in OpenShift (Part 1)”

Share

Using RHQ (JON) to monitor Java apps

While there is not yet a RHQ plugin for Glassfish, it is already possible to monitor an instance of Glassfish (GF), using the existing JMX Server resource template. Let’s see how this unfolds…

Set up

Foreword: While not difficult, setting this up on a laptop requires running a LOT of Java processes, on top of a database. As the latter needs to be a somewhat older version of PostgreSQL (8.4), you might even end up running it on VM using virt-manager. That is to say, at the end of the day, you do need a little bit of memory and CPU power…

Here what do we need to run exactly:

Continue reading “Using RHQ (JON) to monitor Java apps”

Share

Top Red Hat Developer News of 2013

Red Hat brought a LOT of new and excellent application development products and capabilities during 2013, so I thought I would assemble this list for you here in case you missed any.  Note that this is not a complete list (and comment if I missed something that you feel should be mentioned), and by the way, it is listed in random order.

Red Hat Software Collections general availability.  Yes, I will list this first as it’s my personal favorite as I started working on this two years prior as part of a project initially called Robbin, a moniker cleverly coined by Brian Gollaher, our RHEL developer tools product manager.  (We learned that people would be distracted if we gave it a name too soon in the planning phase – so they needed to agree on the definition first.  Then we could name it.  Our temporary offices were on Robbins Road then.)  At the time, we all understood the gap that we were trying to address, but it took some time to define it for enterprise use cases and then get some engineering resources (thank you, Denise Dumas).  So now here we are and we’re getting great feedback.  I can’t wait to share news on the next release!  😉

Continue reading “Top Red Hat Developer News of 2013”

Share

Resilient Enterprise Messaging with JBoss A-MQ & Red Hat Enterprise Linux

Background

At JUDCon 2013 in Boston, Scott Cranton and I presented a talk entitled Resilient Enterprise Messaging with Fuse & Red Hat Enterprise Linux. This technical article is the follow up work from that presentation.

JBoss A-MQ is built on ActiveMQ which is a robust messaging platform that supports STOMP, JMS, AMQP and modern principals in Message Oriented Middleware (MOM). It’s built from the ground up to be loosely coupled and asynchronous in nature. This provides ActiveMQ with native high availability capabilities. An administrator can easily configure an ActiveMQ master/slave architecture with a shared filesystem. In the future this will be augmented with Replicated LevelDB.

Red Hat Enterprise Linux is the popular, stable and scalable Linux distribution which has High Availability and Resilient Storage add-on support built on CMAN, RGManager, Corosync, and GFS2. High Availability and Resilient Storage expand upon the high availability capabilities built into ActiveMQ and provide a robust, and complete solution for enterprise deployments that require deeper clustering capabilities.

There are two main architectures commonly used to provide fault tolerance to a messaging server. The first is master/slave which is easy to configure, but as it scales, it requires 2X resources. The second is made up of active nodes and redundant nodes. The redundant nodes can take over for any one of the active nodes should they scale. The active/redundant architecture requires more software and more initial configuration, but uses N+1 or N+2 resources as it scales.

This article will explore the technical requirements and best practices for building and designing a N+1 architecture using JBoss A-MQ, Red Hat Enterprise Linux, the High Availability Add-On and the Resilient Storage Add-On.

Continue reading “Resilient Enterprise Messaging with JBoss A-MQ & Red Hat Enterprise Linux”

Share

Changing objects in flight, without a Debugger

How to change data in-flight, without a Debugger

Do you ever wish you could change the behavior of some object in the middle of a bunch of method calls?  I sometimes do.

Maybe you want to set some properties on an object to replicate a fault.  Maybe you’d like to force a specific return value from a method for some reason.  These are both very possible, without altering the source code for your application.

I like to do this through Byteman.  Byteman is a JBoss project that deals with bytecode injection.  This means that you can inject code you want to run, specifying where you want to run it.  It’s sort of like AOP, except I think it allows more freedom for the user.  It’s also pretty easy to use.

Here’s how:

1)  Make a helper class to do the work you want done
2)  Put the helper class in a .jar
3)  Write the Byteman rule that tells the helper class to do it’s thing

That’s it!  So here’s the example.

Part 1, the helper class
**********************************

public void addMarker(Message msg){
System.out.println(“Changing Message contents.”);
Body msgBody = msg.getBody();
msgBody.add(“Hey, I’ve got changed content”);
System.out.println(“Done changing Message contents”);
}
***********************************

Continue reading “Changing objects in flight, without a Debugger”

Share