The Java Virtual Machine Mike Brunt.  What is the JVM?  Main JVM Suppliers  ColdFusion and the JVM  Java J2EE – Java EE Servlet Containers  Where.

Slides:



Advertisements
Similar presentations
Java EE - Introduction -
Advertisements

Question examples. Session 1 Objectives Why certify? Positioning of the non-technical version What is Java? Key advantages of Java Java Applications vs.
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
PIA Load Balancing, JVMs and Garbage Collection David Kurtz Go-Faster Consultancy Ltd.
® IBM Software Group © 2010 IBM Corporation What’s New in Profiling & Code Coverage RAD V8 April 21, 2011 Kathy Chan
Memory Leak WEBLOGIC SERVER.  Overview of Java Heap  What is a Memory Leak  Symptoms of Memory Leaks  How to troubleshoot  Tools  Best Practices.
NUMA Tuning for Java Server Applications Mustafa M. Tikir.
Introduction to Java The objectives of this chapter are: To describe the key aspects of Java To describe the Java software development kit (SDK) To explain.
UPortal Performance Optimization Faizan Ahmed Architect and Engineering Group Enterprise Systems & Services RUTGERS
14.1 © 2004 Pearson Education, Inc. Exam Planning, Implementing, and Maintaining a Microsoft Windows Server 2003 Active Directory Infrastructure.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
JVM-1 Introduction to Java Virtual Machine. JVM-2 Outline Java Language, Java Virtual Machine and Java Platform Organization of Java Virtual Machine Garbage.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
1 Software Testing and Quality Assurance Lecture 31 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
Introduction to Java.
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
CH 13 Server and Network Monitoring. Hands-On Microsoft Windows Server Objectives Understand the importance of server monitoring Monitor server.
1 Garbage Collection Danny Angus. Introduction Student loans, amongst other things, run B2B applications implementing government policy in the UK. We.
 CFUnited August 12-15, 2009  Mike Brunt – CFWhisperer.
SEG Advanced Software Design and Reengineering TOPIC L Garbage Collection Algorithms.
Memory Leak Overview and Tools. AGENDA  Overview of Java Heap  What is a Memory Leak  Symptoms of Memory Leaks  How to troubleshoot  Tools  Best.
CLR: Garbage Collection Inside Out
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
CSCI 224 Introduction to Java Programming. Course Objectives  Learn the Java programming language: Syntax, Idioms Patterns, Styles  Become comfortable.
WebSphere Performance Drivers William R. Sullivan, P.E. CTO WHAM Engineering & Software.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Bill Au CBS Interactive Troubleshooting Slow or Hung Java Applications.
Computer Programming 12 Mr. Jean March 19 th, 2013.
 CFUnited August 12-15, 2009  Mike Brunt – CFWhisperer 
JAVA Java is a programming language and computing platform first released by Sun Microsystems in It was first developed by James Gosling at Sun Microsystems,
INTRODUCTION TO JAVA AND ANDROID. Slide 2 Our Ecosystem Java Eclipse Android SDK.
Installing, Configuring And Troubleshooting Coldfusion Mark A Kruger CFG Ryan Stille CF Webtools.
Power your JVM with Effective Garbage Collection Tuning SiliconIndia Java Conference 29 th October, 2010 Vivekanand Jha.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
The Alternative Larry Moore. 5 Nodes and Variant Input File Sizes Hadoop Alternative.
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
Garbage Collection and Classloading Java Garbage Collectors  Eden Space  Surviver Space  Tenured Gen  Perm Gen  Garbage Collection Notes Classloading.
A compiler is a computer program that translate written code (source code) into another computer language Associated with high level languages A well.
Finalizers, this reference and static Sangeetha Parthasarathy 06/13/2001.
Docker and Container Technology
INTRODUCTION TO JAVA AND ANDROID. Slide 2 Our Ecosystem Java Eclipse Android SDK.
NJIT 1 Apache Tomcat (Version 6.0) THETOPPERSWAY.COM.
 cfObjective(ANZ)– November 17-18, 2011  Mike Brunt – CFWhisperer.
J2SE 1.5 : Memory Heap and Garbage Collector. Objectives You will be able to understand the JVM Memory Heap You will be able to know what the Garbage.
Glink for Java: applet, application and an API for integrating access to Bull, IBM, UNIX and Minitel systems with your Java based e-business applications.
Java Performance Analysis 301 Peter Johnson CMG 2006, December 7, Session 534, Paper 6033.
Introduction to Programming 1 1 2Introduction to Java.
Linux and Coldfusion MX Mid-Michigan Coldfusion User’s Group, Nov
SQL Database Management
Object Oriented Programming in
Topic: Java Garbage Collection
Before You Begin Nahla Abuel-ola /WIT.
Runtime Analysis of Hotspot Java Virtual Machine
Introduction Enosis Learning.
Introduction to Computers
Enterprise Application Architecture
Introduction Enosis Learning.
Chapter 2: System Structures
Am I Reading GC Logs Correctly?
ColdFusion Performance Troubleshooting and Tuning
(Computer fundamental Lab)
Java History, Editions, Version Features
Review of Previous Lesson
New GC collectors in Java 11
Presentation transcript:

The Java Virtual Machine Mike Brunt

 What is the JVM?  Main JVM Suppliers  ColdFusion and the JVM  Java J2EE – Java EE Servlet Containers  Where everything sits-fits  Tuning the JVM  Metrics Logging  Using utilities to aid in tuning the JVM  References  Summary

 Sun Microsystems created Java as a high-level programming language which should run on as many operating systems and hardware variations as possible. The goal of “write once run anywhere” meant that a predictable encapsulated operating system, no matter what the underlying hardware and software, was required.  The Java Virtual Machine (JVM or JRE) is a multi- threaded environment abstracting the actual computer operating system from the application code.

 These are the main suppliers of Java Virtual Machines, there are others.  Sun Hotspot JVM  IBM JVM  BEA JRockit  MAC OSRuntime for OSX  Oracle JVM aka JServer – OJVM  Microsoft JVM

 Since ColdFusion MX , CF has been a Java Application which needs what is known as a Servlet Container to run on. The most popular Servlet Container for ColdFusion is JRun.  In the Enterprise edition of ColdFusion, the actual Servlet Container to be used can be selected during the install. In non-Enterprise installs JRun is automatically used. The main point being that there is always a Servlet Container.

 This is a list 0f Java Servlet Containers which are certified as fully J2EE – Java EE compliant by Sun Microsystems.  Geronimo from Apache  JBoss from Red Hat  JRun from Adobe  Oracle OC4J  Sun Java System Application Server (Sun One).  WebLogic Server from BEA  WebSphere Server from IBM

 This is a simple diagram showing where the Operating System, JVM, Servlet Container and Java Application Server sit in relativity.

Windows Install  Standard-Server  Enterprise

 This is a simple diagram showing where the Operating System, JVM, Servlet Container and Java Application Server sit in relativity.

 Garbage Collectors  Garbage Collectors (different arguments to jvm.config)  -XX:+UseParallelGC Use parallel garbage collection, this is typically the default collector for ColdFusion installations. This collector is also referred to as the throughput collector. It uses a parallel version of the young generation collector. The old (tenured) generation is still cleaned with the default collector. Note This option can not be used in conjunction with - XX:+UseConcMarkSweepGC.  -XX:+UseConcMarkSweepGC Use concurrent garbage collection. This collector is also referred to as the concurrent low pause collector. It collects garbage in the old (tenured) generation concurrently to executing the application. Note that this option can not be used in conjunction with -XX:+UseParallelGC. Instead you may combine it with - XX:+UseParNewGC  -XX:+UseParNewGC Instructs the VM to use a parallel collector for the young generation. This option can be used in conjunction with - XX:+UseConcMarkSweepGC.  * As a note I have found that using the ConcMarkSweepGC along with ParNewGC can cause longer Full GC’s, I tend to use ParNewGC on it’s own.

 Full Garbage Collections – Minimize  Sun JVM’s use a generational garbage collector with two young generations and an old generation. New objects are always allocated in the young generation part of the heap. Every time the young generation is full a minor garbage collection takes place. Minor garbage collections don't take very long.  Objects which survived some minor collections, because they are still referenced from the application, are promoted to the older generation. Usually the older generation is full at some point too, and needs to be cleaned. This leads to a major garbage collection or Full Garbage (Full GC) collection that removes garbage from both the old and the younger generations. Full GC’s are “stop-the-world” events and need to occur only when absolutely necessary.

 Full Garbage Collections – Minimize  One of the first methods I always want to employ when troubleshooting is to ascertain how many Full GC’s are taking place. To do so I add these arguments to the jvm.config file, which is located in one of these directories depending on the installation:  Enterprise – {drive-volume}\jrun4\bin  Standard/Server - {drive-volume}\CFusionMX7\runtime\bin -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -verbose:gc -Xloggc:yourname.log* * This will send Garbage collection output to the {std}-out.log and will create a log of all GC activity with whatever name you gave yourname in either..  Enterprise – {drive-volume}\jrun4\bin  Standard/Server - {drive-volume}\CFusionMX7\runtime\bin

 Full Garbage Collections – Minimize  Here is an example of the Verbose Garbage Collection log output… par new generation total 97088K, used 0K [0x , 0x171d0000, 0x171d0000) eden space 77696K, 0% used [0x , 0x , 0x14bf0000) from space 19392K, 0% used [0x14bf0000, 0x14bf0000, 0x15ee0000) to space 19392K, 0% used [0x15ee0000, 0x15ee0000, 0x171d0000) tenured generation total K, used 11109K [0x171d0000, 0x , 0x ) the space K, 1% used [0x171d0000, 0x17ca95b8, 0x17ca9600, 0x ) compacting perm gen total 26624K, used 26606K [0x , 0x51a10000, 0x ) the space 26624K, 99% used [0x , 0x51a0b8a0, 0x51a0ba00, 0x51a10000) }, secs] : [Full GC {Heap before GC invocations=8: Heap  This Full GC was almost certainly unnecessary because at the time it ran only 1109k out of k of the tenured (old) generation had been used. I also note the timestamp ( ) of every Full GC in the log. If I see a regular pattern it almost always means something is calling a Full GC perhaps using system.gc()

 Full Garbage Collections – Minimize – How?  One pattern I have seen over and over with ColdFusion is that Full GC’s are very often occurring at regular 60 second intervals. Although I have never been able to pin this down fully, I suspect it is due to a Java process called RMI(Remote Method Invocation). So then what do we do to control these unnecessary “stop-the-world” Full GC’s? There are two alternatives…  1/ Disable Full GC’s using the -XX:+DisableExplicitGC jvm.config argument. I am not totally happy doing this and in many cases it will not work  2/ Run Full GC’s at longer regular intervals. Applying these arguments instead of -XX:+DisableExplicitGC will cause Full GC’s every 10 minutes (600,000 ms). -Dsun.rmi.dgc.client.gcInterval= Dsun.rmi.dgc.server.gcInterval=600000

 I have found that enabling metrics looking is invaluable in troubleshooting ColdFusion and JRun application issues. Metrics logging will show the status of the CF-JRun instance at pre-selected time intervals in terms of number of threads in use and available memory. In order to enable metrics logging we need to edit the jrun.xml file, here…  Enterprise install {drive-volume}\JRun4\servers\{servername}\SERVER-INF Server-Standard install {drive-volume} \CFusionMX7\runtime\servers\{servername}\SERVER-INF  Setting detail is on the next slide

 Here is how to enable metrics logging in the jrun.xml file  Firstly uncomment the service class…  Then set “metricsEnabled” to true, we will leave other settings to default.  Lastly I like to spilt the logs out to make reading them easier by this change

 Sun JVM Versions up to 1.5 (5.0)  GC Viewer Tool (Sun JVM up to 1.4x)

 I have found that the only way to really determine the correct garbage collector to use for your applications and what the correct arguments are to pass to the JVM, via the jvm.config file, to effectively manage garbage collections is to first determine how many Full GC’s are occurring and control that if there are too many. Then load-test the application whilst tuning the arguments passed to the JVM, via the jvm.config file.

Mike Brunt