Monday, September 29, 2014

Review: "Java EE 7 Performance Tuning and Optimization" by Osama Oransa

Latest Packt Publishing Java EE 7 books are all around performance and tuning. I had the pleasure to review another book, the  "Java EE 7 Performance Tuning and Optimization" by Osama Oransa.

Abstract
With the expansion of online enterprise services, the performance of an enterprise application has become a critical issue. Even the smallest change to service availability can severely impact customer satisfaction, which can cause the enterprise to incur huge losses. Performance tuning is a challenging topic that focuses on resolving tough performance issues.
In this book, you will explore the art of performance tuning from all perspectives using a variety of common tools, while studying many examples.
This book covers performance tuning in Java enterprise applications and their optimization in a simple, step-by-step manner. Beginning with the essential concepts of Java, the book covers performance tuning as an art. It then gives you an overview of performance testing and different monitoring tools. It also includes examples of using plenty of tools, both free and paid.

Book: "Java EE 7 Performance Tuning and Optimization"
Language : English
Paperback: 478 pages
Release Date: June 23, 2014
ISBN-10: 178217642X
ISBN-13: 978-1782176428

About the Author
Osama Oransa (blog) is an IT solution architect with more than 12 years of technical experience in Java EE. He is a certified Java enterprise architect and an SME in web services technology. He is currently working with the Vodafone Group as a solution architect. He has a diploma in IT from the Information Technology Institute (ITI) and a diploma in CS from the Arab Academy for Science, Technology and Maritime Transport (AASTM). He is currently working towards a Master's degree in CS. In 2010, one of his projects in Pulse Corp, "Health Intact", won Oracle Duke's Choice Award. He is the founder of more than 12 open source projects hosted on SourceForge.

The Content
Chapter 1, Getting Started with Performance Tuning, takes you through the art of performance tuning with its different components and shows you how to think when we face any performance issue. It focuses on preparing you to deal with the world of performance tuning and defining the handling tactics.
Chapter 2, Understanding Java Fundamentals, lays the foundation of required knowledge of the new features in Java Enterprise Edition 7 and different important Java concepts, including the JVM memory structure and Java concurrency. It also focuses on the different Java Enterprise Edition concurrency capabilities.
Chapter 3, Getting Familiar with Performance Testing, discusses performance testing with its different components, defines useful terminologies that you need to be aware of, and then gives hands-on information about using Apache JMeter to create your performance test plans for different components and get the results.
Chapter 4, Monitoring Java Applications, dissects the different monitoring tools that will be used in performance tuning, starting from the operating system tools, different IDE tools, JDK tools, and standalone tools. It covers JProfiler as an advanced profiling tool with its offline profiling capabilities.
Chapter 5, Recognizing Common Performance Issues, discusses the most common performance issues, classifies them, describes the symptoms, and analyzes the possible root causes.
Chapter 6, CPU Time Profiling, focuses on the details of getting the CPU and time profiling results, ways to interpret the results, and ways to handle such issues. It discusses the application logic performance and ways to evaluate different application logics. It provides the initial performance fixing strategy.
Chapter 7, Thread Profiling, discusses thread profiling with details on how to read and interpret thread profiling results and how to handle threading issues. It also highlights the ways to get, use, and read the thread dumps.
Chapter 8, Memory Profiling, discusses how to perform memory profiling, how to read and interpret the results, and how to identify and handle possible issues. It also shows how to read and query memory heap dumps and analyze the different out of memory root causes. The chapter finishes your draft performance fixing strategy.
Chapter 9, Tuning an Application's Environment, focuses on tuning the application environment, starting from the JVM and passing through other elements such as the application servers, web servers, and OS. We will focus on selected examples for each layer and discuss the best practices for tuning them.
Chapter 10, Designing High-performance Enterprise Applications, discusses design and architecture decisions and the performance impact. This includes SOA, REST, cloud, and data caching. It also discusses the performance anti-patterns.
Chapter 11, Performance Tuning Tips, highlights the performance considerations when using the Agile or Test-driven Development methodologies. This chapter also discusses some performance tuning tips that are essential during the designing and development stages of the Java EE applications, including database interaction, logging, exception handling, dealing with Java collections, and others. The chapter also discusses the javap tool that will help you to understand the compiled code in a better way.
Chapter 12, Tuning a Sample Application, includes hands-on, step-by-step tuning of a sample application that has some performance issues. We will measure the application performance and tune the application issues, and re-evaluate the application performance.

Writing and Style
The language is clear and easy to follow. Illustrations and tables makes understanding of the written word easier. Even a non native speaker can follow easily.

Conclusion and Recommendation
80 percent of the book cover general performance tuning, monitoring and profiling. Only the last three chapters cover additional information for enterprisy applications. The sample application walk through is kind of helpful and gives beginners a decent idea at what to look if you have never done that kind of things before. The title is highly confusing and I would have picked a more general name. This book is not intended to cover Java EE features; it simply highlights some essential fundamentals we should be aware of while dealing with Java performance tuning and applies more general to Java SE based applications.

Friday, September 26, 2014

Exploring the SwitchYard 2.0.0.Alpha2 Quickstarts

In one of my last posts I explained how you get started with SwitchYard on WildFly 8.1. In the meantime the project was busy and released another Alpha2. A very good opportunity to explore the quickstarts here and refresh your memory about it. Beside the version change, you can still use the earlier blog to setup you local WildFly 8 server with latest Switchyard. As with all frameworks there is plenty of stuff to explore and a prerequisite for doing this is to have a working development environment to make this easier.

Setting up JBoss Developer Studio
First things first. Download a copy of the latest JBoss Developer Studio (JBDS) 7.1.1.GA for your operating system and install it. You should already have a JDK in place so a simple

java -jar jbdevstudio-product-eap-universal-7.1.1.GA-v20140314-2145-B688.jar

will work. A simply 9 step installer will guide you through the steps necessary. Make sure to select the suitable JDK installation. JBDS works and has been tested with Java SE 6.x and 7.x. If you like to, install the complete EAP but it's not a requirement for this little how-to. A basic setup without EAP requires roughly 400 MB disc space and shouldn't take longer than a couple of minutes. If you're done with that part launch the IDE and go on and configure the tooling. We need the JBoss Tools Integration Stack (JBTIS). Configure them by visiting "Help -> Install New Software" and add a new Update Site with the "Add" button. Call it SY-Development and point it to: "http://download.jboss.org/jbosstools/updates/development/kepler/integration-stack/"
Wait for the list to refresh and expand the JBoss Integration and SOA Development and select all three SwitchYard entries. Click your way through the wizards and you're ready for a re-start.

SY Tooling 2.0.0
Please make sure to disable Honour all XML schema locations in preferences, XML→XML Files→Validation after installation.  This will prevent erroneous XML validation errors from appearing on switchyard.xml files.

Preventing erroneous XML validation
That's it for sure. Go ahead and import the bean-service example from the earlier blog-post (Import -> Maven -> Existing Maven Projects)

General Information about SwitchYard Projects
Lets find out more about the general SwitchYard project layout before we dive into the bean-service example.  A SwitchYard project is a Maven based project with the following characteristics:
  • a switchyard.xml file in the project's META-INF folder
  • one or more SwitchYard runtime dependencies declared in the pom.xml file
  • org.switchyard:switchyard-plugin mojo configured in the pom.xml file
Generally, a SwitchYard project may also contain a variety of other resources used to implement the application, for example: Java, BPMN2, DRL, BPEL, WSDL, XSD, and XML files. The tooling supports you with creating, changing and developing your SY projects. You can also add SY capabilities to existing Maven projects. More details can be found in the documentation for the Eclipse tooling.

Exploring the Bean-Service Example
The Bean-Service example is one of the more simpler ones to get a first impression about SY. All of the example applications in the Quickstarts repository are included in quickstarts/ directory of your installation and also available on GitHub. The bean-service quickstart demonstrates the usage of the bean component. The scenario is easy: An OrderService, which is provided through the OrderServiceBean, and an InventoryService which is provided through the InventoryServiceBean implementation take care of orders. Orders are submitted through the OrderService.submitOrder, and the OrderService then looks up items in the InventoryService to see if they are in stock and the order can be processed. Up to here it is basically a simple CDI based Java EE application. In this application the simple process is invoked through a SOAP gateway binding (Which is indicated by the little envelope).
Bean Service Quickstart Overview
Let's dive into the implementation a bit. Looking at the OrderServiceBean reveals some more details. It is the implementation of the OrderService interface which defines the operations. The OrderServiceBean is just a bean class few extra CDI annotations. Most notably is the
@org.switchyard.component.bean.Service(OrderService.class)
The @Service annotation allows the SwitchYard CDI Extension to discover your bean at runtime and register it as a service. Every bean service must have an @Service annotation with a value identifying the service interface for the service. In addition to providing a service in SwitchYard, beans can also consume other services. Those references need to be injected. In this example the InventoryService is injected
 @Inject
 @org.switchyard.component.bean.Reference
 private InventoryService _inventory;
Finally, all you need is the switchyard.xml configuration file where your Service, Components, Types and implementations are described.
<composite name="orders" >
   <component name="OrderService">
    <implementation.bean class="org.switchyard.quickstarts.bean.service.OrderServiceBean"/>
      <service name="OrderService">
        <interface.java interface="org.switchyard.quickstarts.bean.service.OrderService"/>
      </service>
  </component>
</composite>

That was a very quick rundown. We've not touched the webservice endpoints, the WSDL and the Transformer configuration and implementation. Have a look at the SwitchYard tutorial which was published by mastertheboss and take the chance to read more about SY at the following links:



Wednesday, September 24, 2014

Developer Interview (#DI 5) Jeff Genender (@jgenender) about Apache, Karaf, Data and Integration

In my evening hours I had the chance to talk to Jeff Genender (@jgenender) which resulted in a new episode of my developer interviews. We talked about all things Apache and integration and also a bit about Java EE and microservices and what today's customers want from a modern architecture.

Jeff Genender is a Java Champion, Apache Member, and Java Open Source consultant specializing in SOA and enterprise service implementation. Jeff has over 23 years of software architecture, team lead, and development experience in multiple industries. He is a frequent speaker at such events as TheServerSide Symposium, JavaZone, Java In Action, JavaOne, JFokus, and numerous Java User Groups on topics pertaining to Enterprise Service Bus (ESBs), Service Oriented Architectures (SOA), and application servers.
Jeff is an active committer and Project Management Committee (PMC) member for Apache ServiceMix, CXF, Geronimo, a comitter on OpenEJB and Mina, and author of several very popular Mojo (Maven plugins). He is the author of Enterprise Java Servlets (Addison Wesley Longman, 2001), co – author of Professional Apache Geronimo (2006, Wiley), and co-author of Professional Apache Tomcat (2007, Wiley). Jeff also serves as a member of the Java Community Process (JCP) expert group for JSR-342 (Java Platform, Enterprise Edition 7 (Java EE 7) Specification) as a representative of the Apache Software Foundation.

As usual, time to grab a coffee+++ and lean back while listening! Thank you Jeff, for taking the time..

 

Thursday, September 18, 2014

Red Hat to Acquire FeedHenry - It takes a Village to raise an app

Red Hat, Inc.today announced that it has signed a definitive agreement to acquire FeedHenry, a leading enterprise mobile application platform provider. This will expand Red Hat’s portfolio of application development, integration, and Platform-as-a-Service (PaaS) solutions and support our customers with mobile application development in public and private environments.
A warm welcome to the FeedHenry Team at Red Hat!

What is FeedHenry?
It is a cloud-based mobile application platform to design, develop, deploy and mobile applications. The platform provides specific services for security, notification and data synchronization. You can build hybrid apps not only for iOS, Android, Blackberry and Windows Phone mobile devices but
also as web apps accessible from any browser. On top it enables developer to build access to corporate data and applications into those applications and build backend logic that supports their mobile applications.

What are the technical components?
The open and extensible architecture is based on Node.js for client and server side mobile app development. It supports a wide variety of popular toolkits including native SDKs, hybrid Apache Cordova, HTML5 and Titanium, as well as frameworks such as Xamarin, Sencha Touch, and other JavaScript frameworks. Out-of-the-box Node.js plugins are a set of best-in-class Node.js modules that have been tested and curated, ready for developers to cut and paste into their app projects. Those exist for things like Dropbox, Facebook, Google APIs, EC2, Remote Databases, SaaS Connectors,

Why and where does it fit in?
Feedhenry is going to be alligned with the open hybrid cloud strategy and will enable enterprises to accelerate mobile app development and backend integration via private clouds, public clouds, and on-premises. So this is an important addition to Red Hat’s JBoss xPaaS for OpenShift strategy. Learn more about xPaaS in a recent blog-entry. Mobile application services are a key part of that vision and FeedHenry provides the security, policy management, synchronization, and integration features to support mobile applications.


Join the Webcast
Craig Muzilla, senior vice president, Application Platform Business, Red Hat, and Cathal McGloin, chief executive officer, FeedHenry, will host a webcast to discuss this announcement tomorrow, Sept. 19, 2014, at 11 a.m. EDT. Following remarks, press and analysts are invited to participate in a live question and answer session. Join the webcast or view the replay after the event.

Further Readings
FAQ – Red Hat acquisition of FeedHenry
Read the complete press-release on the official Red Hat website.
@feedhenry
Announcement on the Feedhenry website.
Some real-life demos and tutorials on vimeo
Blog-POst from Craig Muzilla

Wednesday, September 17, 2014

WildFly 9 - Don't cha wish your console was hawt like this!

Everybody heard the news probably. The first WildFly 9.0.0.Alpha1 release came out Monday. You can download it from the wildfly.org website The biggest changes are that it is built by a new feature provisioning tool which is layered on the now separate core distribution and also contains a new Servlet Distribution (only a 25 MB ZIP) which is based on it. It is called "web lite" until there'll be a better name.
The architecture now supports server suspend mode which is also known as graceful shutdown. For now only Undertow and EJB3 use this so far. Additional subsystems still need to be updated. The management APIs also got notification support. Overall 256 fixes and improvements were included in this release. But let's put all the awesomeness aside for a second and talk about what this post should be about.

Administration Console
WildFly 9 got a brushed up admin console. After you downloaded, unzipped and started the server you only need to add a user (bin/add-user.sh/.bat) and point your browser to http://localhost:9990/ to see it.

With some minor UI tweaks this is looking pretty hot already. BUT there's another console out there called hawtio! And what is extremely hot is, that it already has some very first support for WildFly and EAP and here are the steps to make it work.

Get Hawtio!
You can use hawtio from a Chrome Extension or in many different containers - or outside a container in a stand alone executable jar. If you want to deploy hawtio as a console on WildFly make sure to look at the complete how-to written by Christian Posta. The easiest way is to just download latest executable 1.4.19 jar and start it on the command line:
java -jar hawtio-app-1.4.19.jar --port 8090
The port parameter lets you specify on which port you want the console to run. As I'm going to use it with WildFly which also uses the hawtio default port this is just directly using another free port.
Next thing to do is to install the JMX to JSON bridge, on which hawtio relies to connect to remote processes. Instead of directly using JMX which is blocked on most networks anyway the Jolokia project bridges JMX MBeans to JSON and hawtio operates on them. Download latest Jolokia WAR agent and deploy it to WildFly. Now you're almost ready to go. Point your browser to the hawtio console (http://localhost:8090/hawtio/) and switch to the connect tab. Enter the following settings:
And press the "Connect to remote server" button below. Until today there is not much to see here. Beside a very basic server information you have the deployment overview and the connector status page.
But the good news is: Hawtio is open source and you can fork it from GitHub and add some more features to it. The WildFly/EAP console is in a hawtio-web subproject. Make sure to check out the contributor guidelines.