Learn how IBM Solution for WebSphere Mobile and Web Applications on PowerLinux makes IBM WebSphere Application Server Liberty profile available for PowerLinux servers. This solution harnesses the strength of IBM hardware and software, improving reliability, availability and security. For more information on Power Systems , visit http://ibm.co/Lx6hfc.
Visit http://bit.ly/KWh5Dx to 'Follow' the official Twitter handle of IBM India Smarter Computing.
Infrastructure Matters 2014 IBM systems and servers
Introduction to Enabling and Developing Java Applications on PowerLinux Servers
1. Industry standard Linux, solutions tuned to the task
Introduction to Enabling and Developing Java Applications
on PowerLinux Servers
January 2013
Authors:
Jason Furmanek, IBM Lab Services, Power and Linux services
Paul Clarke, IBM Lab Services, Power and Linux services
2. Table of Contents
Table of Contents …............................................................................................2
Introduction …....................................................................................................3
Scope of this Paper ….........................................................................................3
Overview of Java and the IBM JVM …..............................................................3
Why Java on PowerLinux? ….............................................................................4
Where to get IBM Java …...................................................................................5
Recommended Java levels for PowerLinux servers ...........................................5
32-bit vs 64-bit …......................................................................................6
How to install IBM Java ….................................................................................6
InstallAnywhere package installation ...........................................................6
Graphical install ......................................................................................7
Console install ........................................................................................7
Unattended install ...................................................................................7
RPM package installation .............................................................................7
Upgrading IBM Java ..........................................................................................7
Uninstalling IBM Java …....................................................................................8
Manual uninstall ...........................................................................................8
Alternative uninstall ......................................................................................8
Common JVM Options and Performance Considerations ….............................8
Prefetching …............................................................................................8
Compressed references …............................................................................9
Garbage collection options ….....................................................................10
Java Heap ...................................................................................................10
Lock reservation ….....................................................................................11
IBM Solution for WebSphere Mobile and Web Applications on PowerLinux .11
Conclusion …...................................................................................................12
Related Content …............................................................................................14
Copyright ….....................................................................................................16
3. Introduction
The Java programming language is a high-level, object-oriented language. Java
programs are both compiled and interpreted. Java code is compiled into bytecode. The
bytecode is then interpreted at run time by a platform-specific Java component. This
component acts as a translator between the language and the underlying operating
system and hardware. This staged approach to compiling and interpreting Java
applications, means that application code can be easily ported across hardware platforms
and operating systems as long as the target systems have the required Java components.
The Java platform is also a set of specifications. These specifications govern the
language, the compilation and interpretation of the language, functions, additions, and
interfaces. IBM was an original licensee of these specifications and a leader in Java
technology, resulting in an IBM implementation of the Java platform.
Scope of this paper
This paper introduces IBM Java on the IBM PowerLinux 7R2 server and describes
IBM's implementation of the Java platform, which includes IBM's Java Virtual Machine
and development toolkit. The primary focus is education and illustration of the Java
platform as they pertain to these systems.
The scope also includes a brief look at some of the Java Virtual Machine options that are
unique to IBM's implementation as well as some basic performance advice for running
IBM Java on IBM PowerLinux servers.
Overview the IBM JVM
The IBM implementation of the Java™ platform provides two installable packages: a
software development toolkit (SDK) and an Java application runtime environment (JRE
). The SDK includes the JRE along with compilers, development tools and integration
libraries that are helpful in the creation of Java programs.
The JRE is also available as a separate package and includes the IBM Java Virtual
Machine, which is the component that interprets the compiler Java bytecode at runtime.
The JRE also includes the Java core class library, the just-in-time compiler (JIT), the
Garbage Collector, and tools that are used to manage and operate the runtime
environment.
The IBM Java Virtual Machine, called J9, was designed for portability and has been
4. released on everything from mobile devices up to the Z-series mainframes, including
IBM PowerLinux servers.
The IBM J9 Virtual Machine for Java is certified as Java compliant. Compliant JVMs
implement the specification completely and correctly, however not all compliant JVMs
are identical.
JVM implementers have a wide degree of freedom to define characteristics that are
beyond the scope of the specification. For example, implementers might choose to favor
performance or memory footprint; they might design the JVM for rapid deployment on
new platforms or for various degrees of serviceability.
The IBM J9 Virtual Machine for Java contains many optimizations and options to take
advantage of the POWER7 processor and is therefore the recommended JVM for
PowerLinux servers.
All the enterprise level JVMs that are currently used commercially include a
supplementary "just-in-time" compiler that takes bytecode and produces platform-
dependent machine code. This compiler works with the JVM to select parts of the Java
program that could benefit from the compilation of bytecode, and replaces the JVM's
virtualized interpretation of these areas of bytecode with concrete code. This is called
just-in-time (JIT) compilation and is the job of the just-in-time compiler included with
the JRE.
Why Java on PowerLinux?
The Java platform has become absolutely ubiquitous and is one of the foundation
technologies of many web and cloud based applications. The Java promise of “Write
Once, Run Anywhere”, realized by the Java Virtual Machine, provides the freedom to
seek the best hardware platform on which to run.
With Java applications having this inherent portability, vastly different platforms can be
evaluated based on merits instead of painful Person-Month porting sizings.
Platforms with heavily optimized JVMs, robust RAS capabilities, unmatched system
virtualization and competitive pricing can be leveraged easier than ever before.
IBM PowerLinux servers are built from the ground up for running Java applications in a
flexible, performance optimized, cloud-ready environment. Leveraging IBM Java
technologies provides access to the wide world of Java-powered applications including
everything from Enterprise-class application servers to Java enabled web servers and
open source system tools. This support coupled with the unique speed enhancement of
5. the IBM J9 Virtual Machine for Java and the enterprise level RAS and virtualization
features of IBM Power Systems make IBM PowerLinux servers the ideal hardware
platform for Java.
Where to get IBM Java
The IBM JRE and SDK packages can be found online at the following website:
http://www.ibm.com/developerworks/java/jdk/linux/download.html
The packages hosted at the above website are InstallAnywhere packages, which use
the .bin extension. These packages replace the .rpm and .tgz packages that were
previously provided. There are two types of InstallAnywhere package, installable and
archive. The installable packages are equivalent to the .rpm packages that were
previously provided and are used for a full product installation. The archive packages
are equivalent to the .tgz packages that were previously provided.
The IBM® Installation Toolkit for PowerLinux also contains packages for the IBM Java
SDK. The IBM® Installation Toolkit is a strategic tool for delivering IBM software
solutions for PowerLinux servers. Depending on release schedules, the toolkit may not
always have the latest Java version included. To get the latest service releases for IBM
Java, getting the packages online is recommended.
Recommended Java levels for PowerLinux servers
Java levels are important since features are introduced in new levels of the JVM and old
APIs may become deprecated. In general, however, Java programs compiled using an
older version of IBM Java should run on newer versions. Java programs compiled with
newer versions of Java are not guaranteed to run on older versions.
The IBM J9 Virtual Machine for Java has its own major build number that is separate
from the Java version number. Both the Java version and the J9 build number are
displayed by using the “java -version” command.
For PowerLinux servers and POWER7 servers in general, Java 6 SR7 or later is
recommended. This recommendation is based on two primary reasons. First, these
versions use 64 KB pages by default for JVM text, data, and stack memory segments as
well as the Java heap. Second, the JIT compiler in Java 6 SR7 and later takes advantage
of POWER7 specific hardware features for performance. Together, these reasons result
in better performance when compared to older releases of the JVM.
6. Java 7 introduced build 2.6 of the IBM J9 Virtual Machine and it contains numerous
performance improvements, making the latest service release of Java 7 the preferred
version of Java to use on PowerLinux servers.
32-bit verses 64-bit
The IBM J9 Virtual Machine for Java comes in both 32-bit and 64-bit versions. Deciding
which to use typically comes down to the characteristics of the Java workload that will
be running in the environment.
Workloads that do not require large amounts of memory typically run faster as 32-bit
applications. This situation occurs because of the larger data types, like 64-bit pointers
instead of 32-bit pointers, which increase the memory footprint and demand on memory
throughput. In addition, the memory alignment of application data contributes to
memory demand in 64-bit applications.
In general, unless the memory requirement of the Java application requires running in
64-bit mode, it is a good idea use the 32-bit IBM Java packages.
How to install IBM Java
The following section discusses the installation of IBM Java packages found either on
the IBM website listed above, or on the IBM Installation Toolkit for PowerLinux. The
IBM Java packages require a few shared libraries to exist on the PowerLinux server
before installation:
◦ GNU C library V2.3 (glibc) or higher
◦ libstdc++.so.5
◦ rpm-build
The libstdc++.so.5 shared library is typically found in the compat-libstdc++-33-
3.2.3*.rpm package found on the Linux operating system distribution media.
The rpm-build package is needed in order to register the Java packages in the RPM
database.
InstallAnywhere package installation
There are two types of InstallAnywhere packages, installable and archive. The
installable packages perform the full product install, while the archive packages only
copy the contents of the package to the destination without executing any installation
7. methods that may be defined.
As mentioned, InstallAnywhere packages have the .bin extension and are executable.
There are a few different methods of interaction with the installer.
Graphical install
If a desktop Graphical User Interface is available on the PowerLinux server and the
install can be attended to, then the installation process can be started by typing
./package.bin at a shell prompt, where package is the name of the package that you are
installing. An installation wizard guides the install until completion.
Console install
If only a command line interface is available on the PowerLinux server and the install
can be attended to, then the installation process can be started by typing ./package.bin -i
console at the shell prompt, where package is the name of the package that you are
installing. The text level wizard guides the install using this method.
Unattended install
If more than one system requires installation, and the installation options to use are
already known, the unattended installation process may save some time. This method
works by installing once by using the attended installation process, then use the resulting
response file to complete further installations without any additional user interaction.
An attended installation that creates a response file can be started by typing
./package.bin -r /path/installer.properties at a shell prompt. The response file will be
created at the path given.
Start an unattended installation by running the package installer with the -i silent option,
and the -f option to specify the response file. For example:
./package.bin -i silent -f /path/installer.properties
RPM installation
Older packages that came as RPMs can be installed like any other RPM. For example:
rpm -ivh ./package.rpm
Upgrading IBM Java
You cannot upgrade an existing IBM® SDK or IBM JRE by using the InstallAnywhere
8. packages. To upgrade your IBM SDK or IBM JRE, you must first uninstall any previous
versions.
Uninstalling IBM Java
There is no uninstallation process for InstallAnywhere archive packages. To remove an
archive package from your system, delete the target directory that you chose when you
installed the package.
For InstallAnywhere installable packages, you uninstall the product by using a
command, or by running the installation program again.
Do not attempt to uninstall the product by using the rpm -e command, because this will
corrupt the installed package.
Manual Uninstall
In order to manually uninstall IBM Java, change to the directory that contains the IBM®
SDK or IBM JRE installation. The default is /opt/ibm/java-<arch>-70/, where <arch> is
either ppc (32-bit) or ppc64 (64-bit).
Start the uninstall process by entering the following command:
./_uninstall/uninstall
Alternative uninstall
Running another attended installation is an alternative to the manual uninstall above.
The installation program detects that the product is already installed, then gives you the
opportunity to uninstall the previous installation.
Common JVM options and performance considerations
The topics below are discuss some specifics to the IBM J9 Virtual Machine for Java that
may be unfamiliar to those that are used to Hotspot-based JVMs. The IBM J9 Virtual
Machine for Java offers a large array of command line options and tuning parameters
beyond the ones discussed below.
Prefetching
Prefetching is a technique that attempts to hide memory latency. It is necessary given the
speed of today's processors compared to the speed of system memory. Without a parallel
9. prefetch of either instructions or data, the processor cores would often stall waiting for
data to arrive. IBM POWER7 implements some prefetching schemes into the hardware
and offers the user ways to control the on-chip function.
Recent versions of Java also include robust support for software prefetching in order to
reduce memory latency and take full advantage of on-chip caches. Software prefetching
in IBM Java is fully tuned and optimized for the POWER7 processors in PowerLinux
servers.
Since it could be disadvantageous to run two differing prefetching schemes, it is
recommended that the hardware data prefetch be disabled when using the Java
prefetching function.
Turning off Hardware data prefetch with the Linux command "ppc64_cpu --dscr=1 "
For IBM Java, the -XtlhPrefetch option can be specified to enable aggressive
prefetching of thread-local heap (TLH) memory shortly before objects are allocated.
This will ensure that the memory required for new objects allocated from the thread-
local heap will be fetched into cache ahead of time if possible, thereby reducing latency
and increasing overall object allocation speed.
This option can give noticeable gains on workloads that frequently allocate objects, such
as transactional workloads.
Compressed references
For truly huge workloads 64-bit JVMs may be necessary to meet an application's needs.
64-bit processes primarily offer a much larger address space, thereby allowing for larger
Java heaps, JIT code caches, and reducing the effects of memory fragmentation in the
native heap.
However 64-bit processes also must deal with the increased overhead. The overhead
comes from the increased memory usage and decreased cache utilization. This overhead
is present with every single object allocation, as each object must now be referred to
with a 64-bit address rather than a 32-bit address. To alleviate this, the
-Xcompressedrefs option can be used.
When enabled, the JVM will use 32-bit references to objects instead of 64-bit references
where ever possible
10. Garbage collection options
The IBM J9 Virtual Machine for Java supports multiple garbage collection strategies in
order to allow software developers an opportunity to prioritize various factors.
Throughput, latency, and scaling are the main factors addressed by the different
collection strategies.
The "optthruput" garbage collection strategy is currently the default. This strategy
prioritizes throughput above all else by using a global garbage collector and restricting
collection to relatively short, well defined periods.
Choosing to use a non-default garbage collection strategy very much depends on the
application's behavior with respect to allocation frequencies, required heap size,
expected lifetime of objects, and other factors.
To specify a non-default garbage collection strategy the -Xgcpolicy:<policy> option can
be used.
Non-default garbage collection strategies include: subpool, optavgpause, and gencon.
The subpool strategy is similar to the optthruput strategy in that it also focuses on
throughput, but also takes into consideration scaling on large multi-CPU machines. The
subpool strategy is recommended on large machines of 16 or more processors.
The optavgpause strategy prioritizes latency and response time by performing the initial
mark phase of garbage collection concurrently with the execution of the application.
This may affect throughput, since CPU time that would otherwise go to the application
may be diverted to low priority GC threads.
The gencon strategy employs a generational garbage collection scheme that attempts to
deal with many varying workloads and memory usage patterns. This GC policy is very
well suited to workloads that have many short-lived objects, such as transactional
workloads.
Java Heap Size
The IBM J9 Virtual Machine for Java includes a dynamic memory heap that allows it to
use only as much memory as necessary at any given time. This flexibility is valuable
but comes with the cost of the overhead associated with memory allocation and freeing.
Options can be set to specify the Java memory heap starting and maximum size (the
-Xms<size><M|G> and -Xmx<size><M|G> options, respectively).
11. Setting the maximum size and the starting size to the same value equates to a constant
sized memory heap, which helps eliminate memory allocation overhead, but is only
recommended for servers running dedicated Java applications and not much else.
The Java heap maximum size should not be set to larger than the physical amount of
memory present; otherwise the operating system may have to swap data in and out of
memory.
Lock reservation
Synchronization and locking are an important part of any multi-threaded application.
Shared resources must be adequately protected by monitors to insure correctness, even if
some resources are only infrequently shared.
If a resource is primarily accessed by a single thread at any given time that thread will
frequently be the only thread to acquire the monitor guarding the resource. In such cases
the cost of acquiring the monitor can be reduced with the -XlockReservation option.
With this option it is assumed that the last thread to acquire the monitor will likely also
be the next thread to acquire it. The lock is therefore said to be reserved for that thread,
thereby minimizing its cost to acquire and release the monitor.
This option is well suited to workloads using many threads and many shared resources
that are infrequently shared in practice.
IBM Solution for WebSphere Mobile and Web Applications on
PowerLinux
IBM WebSphere Application Server is a proven, high-performance transaction engine
that can help build, run, integrate, and manage mobile and dynamic web-based Java
applications. The latest edition of WebSphere Application Server introduces new options
for the development community with the lightweight Liberty profile option and
development tool options.
The WAS Liberty profile option is designed as a dynamic profile of WAS that enables
the WAS server to provision only the features required by the application (or set of
applications) deployed to the server. WAS consists of central "kernel" component and a
large number of features, application bundles, and enterprise APIs. The WAS Liberty
profile makes sure to load only what is needed, which reduces the memory footprint of
WAS as well as accelerates start up times.
12. Additionally, newly utilized features can be enabled and dynamically added without
restarting the server. Operations are enhanced with Intelligent Management capabilities
that minimize end-user outages and maximize operations monitoring and control of the
production environment.
The new development tools option includes WAS Developer Tools for Eclipse(WDT),
which is a lightweight set of tools for the Eclipse IDE used for developing, assembling,
and deploying Java EE, OSGi, Web 2.0, and mobile applications to WebSphere
Application Server. The WDT also includes many of the most common Rational
Application Developer tools that can be added to Eclipse.
IBM Solution for WebSphere Mobile and Web Applications on PowerLinux runs on the
highly secure, resilient, Linux optimized IBM PowerLinux servers, enabling faster time-
to-delivery.
IBM PowerLinux servers have a design that compliments WebSphere Application
Server deployment scenarios. Reliability, availability and serviceability (RAS)
capabilities include recovery from intermittent errors or failover to redundant
components, detection and reporting of failures and impending failures, and self-healing
hardware that automatically initiates actions to effect error correction, repair or
component replacement. In addition, the Processor Instruction Retry feature provides for
the continuous monitoring of processor status with the capability to restart a processor if
certain errors are detected. If required, workloads are redirected to alternate processors,
all without disruption to application execution. The dynamic nature and flexibility of
WAS Liberty profile makes deployment on PowerLinux servers a perfect fit for critical
business applications.
Conclusion
The Java platform on PowerLinux servers is easy to install and re-install as new versions
are released. New function and performance improvements are included in the regular
releases of IBM Java. The included SDK can be leveraged with external tools (see
Related Content), along with the many open source and community tools of choice.
Everything needed to develop world class Java applications is easily accessible.
IBM Solution for WebSphere Mobile and Web Applications on PowerLinux makes IBM
WebSphere Application Server Liberty profile available for PowerLinux servers. This
solution harnesses the strength of IBM hardware and software, improving reliability,
availability and security. It enables rapid mobile and web application development and
is simple to configure and administer, leading to compelling economics on total
solutions costs.
13. The prevalence and portability of Java enables an industry-wide conversation on best
and most capable platforms to run on. The enterprise class features of the PowerLinux
hardware matched with a highly optimized JVM in the IBM J9 Virtual Machine make
PowerLinux 7R2 servers an ideal target for enterprise class Java workloads: industry
standard Java powered by industry standard Linux, tuned to the task from the application
down to the hardware.
14. Related Content
The PowerLinux Community
https://www.ibm.com/developerworks/group/tpl
IBM Redbooks
Performance on POWER
http://www.redbooks.ibm.com/Redbooks.nsf/RedbookAbstracts/sg248079.html?
Open
Websphere Application Server Liberty Profile Guide for Developers
http://www.redbooks.ibm.com/abstracts/sg248076.html?Open
DeveloperWorks – Artcile about Java performance on PowerLinux
http://www.ibm.com/developerworks/wikis/display/LinuxP/Java+Performance+on+PO
WER7
Eclipse - A community driven development IDE for Java
http://www.eclipse.org/
Websphere - Java based service-oriented architecture (SOA) software from IBM
http://www-01.ibm.com/software/websphere/
Webshpere Application Server Developer Tools for Eclipse (WDT)
http://marketplace.eclipse.org/
Rational Application Developer
http://www-142.ibm.com/software/products/us/en/application/
Websphere Development Community
http://www.ibm.com/wasdev
Download page:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download
?lang=en
IBM Java 7 Guide
http://publib.boulder.ibm.com/infocenter/java7sdk/v7r0/index.jsp
IBM Java 6 Guide
http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp