Free tutorials for Java, Eclipse and Web programming



Follow me on twitter

Java Performance - Memory and Runtime Analysis - Tutorial

Lars Vogel

Version 0.8

12.12.2010

Revision History
Revision 0.128.12.2008Lars Vogel
created
Revision 0.2 -0.812.01.2009 - 12.12.2010Lars Vogel
bug fixes and enhancements

Abstract

This article will be a collection of Java performance measurement pointer.

It describes how memory works in general and how Java use the heap and the stack. The article describes how to set the available memory for Java. It discusses then how to get the runtime and the memory consumption of a Java application.


Table of Contents

1. Performance factors
2. Memory
2.1. Native Memory
2.2. Memory in Java
2.3. Java Heap
2.4. Java Stack
2.5. Escape Analysis
3. Garbage Collector
4. Memory settings for Java virtual machine
5. Memory Consumption and Runtime
5.1. Memory Consumption
5.2. Runtime of a Java program
6. Lazy initialization
6.1. Concurrency - Overview
6.2. Double-Check Item
7. Just-in-time (JIT) compiler
8. Profiler
9. Load Test
10. Thank you
11. Questions and Discussion
12. Links and Literature
12.1. Performance

1. Performance factors

Important influence factors to the performance of a Java program can be separated into two main parts:

  • Memory Consumption of the Java program

  • Total runtime of a program

In case the program is to some case a program which interacts with others also the response time is a very important fact of the performance of a program.

Tip

A average CPU can do approximately 1 billion (10^9) operations per second.

This article does not cover concurrency. If you want to read about concurrency / multithreading please see Concurrency / Multithreading in Java