SlideShare uma empresa Scribd logo
1 de 56
29th October 2013

From Java Code to Java Heap

Understanding the Memory Usage of Your Application

Document number
© 2013 IBM Corporation
Important Disclaimers

THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES
ONLY.
WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION
CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED.
ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED
ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR
INFRASTRUCTURE DIFFERENCES.
ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT
PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF
THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
- CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR
THEIR SUPPLIERS AND/OR LICENSORS

2

© 2013 IBM Corporation
Introduction to the speaker

■

13 years experience developing and deploying Java SDKs

■

Recent work focus:
– Java applications in the cloud
– Java usability and quality
– Debugging tools and capabilities
– Requirements gathering
– Highly resilient and scalable deployments

■

My contact information:
– baileyc@uk.ibm.com
– http://www.linkedin.com/in/chrisbaileyibm
– http://www.slideshare.net/cnbailey/

3

© 2013 IBM Corporation
Goals of this talk

■

Deliver an insight into the memory usage of Java code:
– The overhead of Java Objects
– The cost of delegation
– The overhead of the common Java Collections
–
–

■

Provide you with information to:
– Choose the right collection types
– Analyze your application for memory inefficiencies

4

© 2013 IBM Corporation
Agenda

■

Introduction to Memory Management

■
■

Anatomy of a Java object

■
■

Understanding Java Collections

■
■

5

Analyzing your application

© 2013 IBM Corporation
Java Memory Management

6

© 2013 IBM Corporation
Understanding Java Memory Management

■

Java runs as a Operating System (OS) level process, with the restrictions that the OS
imposes:
0 GB

2 GB

■
■
■

OS and C-Runtime JVM Native Heap
0x0

0x40000000

0x80000000

-Xmx

4 GB

Java Heap(s)
0xC0000000

■

32 bit architecture and/or OS gives 4GB of process address space
– Much, much larger for 64bit

■

Some memory is used by the OS and C-language runtime
– Area left over is termed the “User Space”

■

Some memory is used by the Java Virtual Machine (JVM) runtime

■

0xFFFFFFFF

Some of the rest is used for the Java Heap(s)
…and some is left over: the “native” heap

■

7

Native heap is usually measured including the JVM memory usage
© 2013 IBM Corporation
“Native Heap” Usage

■

■

A number of Java objects are underpinned by OS level resources
– Therefore have associated “native” heap memory
–
Example: java.lang.Thread
–
–

Java Heap

8

Native Heap

© 2013 IBM Corporation
32bit User Space Available to the Java Process

 On Windows (default):
0 GB

2 GB

1 GB

User Space
0x0

0x40000000

4 GB

3 GB

Kernel Space
0xC0000000

0x80000000

Libraries

0xFFFFFFFF

 On Windows (/3GB):
0 GB

2 GB

1 GB

User Space
0x0

9

0x40000000

4 GB

3 GB

Kernel Space
0xC0000000

0x80000000

Libraries

0xFFFFFFFF

© 2013 IBM Corporation
32bit User Space Available to the Java Process

 On Linux (default):
0 GB

2 GB

1 GB

User Space
0x0

0x40000000

4 GB

3 GB

Kernel

0x80000000

0xC0000000

0xFFFFFFFF

 On Linux (Hugemem Kernel):
Separate address space for the Kernel
0 GB

1 GB

2 GB

3 GB

4 GB

User Space
0x0

10

0x40000000

0x80000000

0xC0000000

0xFFFFFFFF

© 2013 IBM Corporation
64 bit User Space Available to the Java Process

Platform

User Space

Windows AMD64
Windows Itanium

7152 GiB

Linux AMD64

500 GiB

Linux PPC64

1648 GiB

Linux 390 64

8 EiB

AIX PPC64

11

8192 GiB

448 PiB

© 2013 IBM Corporation
Anatomy of a Java Object

12

© 2013 IBM Corporation
Anatomy of a Java Object

public class CreateInteger {
public static void main(String[] args) {
Integer myInteger = new Integer(10);
}
}
•
■

Question:

An int (eg. 10) is 32 bits, but how much bigger is an Integer object?
(for a 32bit platform)

(a) x1
(b) x1.5
(c) x2
(d) x3
■

13

Answer is option (e) x4 !!

© 2013 IBM Corporation
Anatomy of a Java Object
public static void main(String[] args) {
Integer myInteger = new Integer(10);
}

 Typical Object Metadata:
– Class:
– Flags:
– Lock:
– Size:
0

pointer to class information
shape, hash code, etc
flatlock or pointer to inflated monitor
the length of the array (arrays only)

32

64

96

128

Class pointer

Locks

Flags

Locks

Size

192

224

256

288

320

Java Object

int: 10

Class pointer

14

Flags

160

int: 10

Array Object

© 2013 IBM Corporation
Anatomy of a Java Object: 64bit
public static void main(String[] args) {
Integer myInteger = new Integer(10);
}

 Typical Object Metadata:
– Class:
– Flags:
– Lock:
– Size:
0

pointer to class information
shape, hash code, etc
flatlock or pointer to inflated monitor
the length of the array (arrays only)

32

64

96

128

Class pointer pointer
Class
Flags

Locks Flags

int

Class pointer pointer
Class
Flags

Locks Flags

Size

160

Locks

int

192

224

256

288

Java Object

int, eg. 10

Locks

320

Size

int, eg. 10

Array Object

 Size ratio of an Integer object to an int value becomes 9:1 !!
15

© 2013 IBM Corporation
Object Field Sizes

Field Type

Field size/bits
32bit Process
Object

Array

64bit Process
Object

Array

boolean

32

8

32

8

byte

32

8

32

8

char

32

16

32

16

short

32

16

32

16

int

32

32

32

32

float

32

32

32

32

long

64

64

64

64

double

64

64

64

64

Objects

32

32

64*

64

*32bits if Compressed References / Compressed Oops enabled

16

© 2013 IBM Corporation
Compressed References and CompressedOOPs

■

Migrating an application from 32bit to 64bit Java increases memory usage:
– Java heap usage increases by ~70%
– “Native” heap usage increases by ~90%
–

■

Compressed References / Compressed Ordinary Object Pointers
– Use bit shifted, relative addressing for 64bit Java heaps
– Object metadata and Objects references become 32bits
–

■

Using compressed technologies does remove Java heap usage increase

■

Using compressed technologies does not remove “native” heap usage increase
–
–

17

© 2013 IBM Corporation
Anatomy of a Java Object: 64bit with Compressed Refs/OOPs
public static void main(String[] args) {
Integer myInteger = new Integer(10);
}

 Typical Object Metadata:
– Class:
– Flags:
– Lock:
– Size:
0

pointer to class information
shape, hash code, etc
flatlock or pointer to inflated monitor
the length of the array (arrays only)

32

64

96

128

Class pointer pointer
Class
Flags

int

Class pointer pointer
Class
Flags

18

Locks Flags

Locks Flags

Size

160

Locks

int

Locks

192

224

256

288

320

Java Object

int, eg. 10

Size

int, eg. 10

Array Object

© 2013 IBM Corporation
Allocating (slightly) more complex objects
public static void main(String[] args) {
String myString = new String("MyString");
}

 Good object orientated design encourages encapsulation and delegation
 Example: java.lang.String encapsulates a character array:

0

32

64

96

128

Class pointer

Flags

Locks

hash

Class pointer

Flags

Locks

Size

160
count

char
M

char
Y

192
offset

char
S

char
T

224

256

char
I

320

java.lang.String

value

char
R

288

char
N

char
G

char[]

 128 bits of char data, stored in 480 bits of memory, size ratio of x3.75
– Maximum overhead would be x24 for a single character!
19

© 2013 IBM Corporation
Understanding Java Collections

20

© 2013 IBM Corporation
Java Collections

■

java.util.HashSet

■
■
■
■
■
■

java.util.HashMap
java.util.Hashtable
java.util.LinkedList
java.util.ArrayList

Increasing Size

Each Java Collection has a different level of function, and memory overhead
Increasing Function

■

Using the wrong type of collection can incur significant additional memory overhead
–

■

21

© 2013 IBM Corporation
HashMap
public static void main(String[] args) {
HashMap myHashMap = new HashMap();
}
■

Implementation of the Map interface:
– “An object that maps keys to values. A map cannot contain duplicate keys; each key can
map to at most one value.“
• Java Platform SE 6 API doc
•

■

Implementation is an array of HashMap$Entry objects:

■
■
■
■

Default capacity is 16 entries

■

Empty size is 128 bytes

■

Overhead is 48 bytes for HashMap, plus (16 + (entries * 4bytes)) for array
– Plus overhead of HashMap$Entry objects

22

© 2013 IBM Corporation
HashMap Structure
HashMap

array[16]

23

© 2013 IBM Corporation
HashMap$Entry

■

Each HashMap$Entry contains:
– int
KeyHash
– Object
next
– Object
key
– Object
value
–

■

Additional 32bytes per key ↔ value entry

■

Overhead of HashMap is therefore:
– 48 bytes, plus 36 bytes per entry
–

■

For a 10,000 entry HashMap, the overhead is ~360K
–

24

© 2013 IBM Corporation
HashMap Structure
HashMap

array[16]

HashMap$Entry

HashMap$Entry

HashMap$Entry

Object key

Object key

Object key

Object value

Object value

Object value

HashMap$Entry

Object key

Object value

HashMap$Entry

Object key

Object value

25

© 2013 IBM Corporation
Hashtable
public static void main(String[] args) {
Hashtable myHashtable = new Hashtable();
}
■

Implementation of the Map interface:
– “This class implements a hashtable, which maps keys to values. Any non-null object can
be used as a key or as a value.“
• Java Platform SE 6 API doc
•

■

Implementation is an array of Hashtable$Entry objects:

■
■
■
■

Default capacity is 11 entries

■

Empty size is 104 bytes

■

Overhead is 40 bytes for Hashtable, plus (16 + (entries * 4bytes)) for array
– Plus overhead of Hashtable$Entry objects

26

© 2013 IBM Corporation
HashTable Structure
HashTable

array[11]

27

© 2013 IBM Corporation
Hashtable$Entry

■

Each Hashtable$Entry contains:
– int
KeyHash
– Object
next
– Object
key
– Object
value
–

■

Additional 32bytes per key ↔ value entry

■

Overhead of Hashtable is therefore:
– 40 bytes, plus 36 bytes per entry
–

■

For a 10,000 entry Hashtable, the overhead is ~360K
–

28

© 2013 IBM Corporation
HashTable Structure
HashTable

array[11]

HashTable$Entry

HashTable$Entry

HashTable$Entry

Object key

Object key

Object key

Object value

Object value

Object value

HashTable$Entry

Object key

Object value

HashTable$Entry

Object key

Object value

29

© 2013 IBM Corporation
LinkedList
public static void main(String[] args) {
LinkedList myLinkedList = new LinkedList();
}
■

Linked list implementation of the List interface:
– “An ordered collection (also known as a sequence). The user of this interface has
precise control over where in the list each element is inserted. The user can access
elements by their integer index (position in the list), and search for elements in the list.
– Unlike sets, lists typically allow duplicate elements. “
• Java Platform SE 6 API doc
•

■

Implementation is a linked list of LinkedList$Entry objects (or LinkedList$Link):

■
■
■

Default capacity is 1 entry

■

Empty size is 48 bytes

■

Overhead is 24 bytes for LinkedList, plus overhead of LinkedList$Entry/Link objects

30

© 2013 IBM Corporation
LinkedList Structure

LinkedList

31

© 2013 IBM Corporation
LinkedList$Entry / Link

■

Each LinkedList$Entry contains:
– Object
previous
– Object
next
– Object
entry
–

■

Additional 24bytes per entry

■

Overhead of LinkedList is therefore:
– 24 bytes, plus 24 bytes per entry
–

■

For a 10,000 entry LinkedList, the overhead is ~240K

32

© 2013 IBM Corporation
LinkedList Structure

LinkedList

LinkedList$Entry

LinkedList$Entry

LinkedList$Entry

Object value

33

LinkedList$Entry

Object value

Object value

Object value

© 2013 IBM Corporation
ArrayList
public static void main(String[] args) {
ArrayList myArrayList = new ArrayList();
}
■

A resizeable array instance of the List interface:
– “An ordered collection (also known as a sequence). The user of this interface has
precise control over where in the list each element is inserted. The user can access
elements by their integer index (position in the list), and search for elements in the list.
– Unlike sets, lists typically allow duplicate elements. “
• Java Platform SE 6 API doc

■
■

Implementation is an array of Object:

■
■
■

Default capacity is 10 entries

■

Empty size is 88 bytes

■

Overhead is 32bytes for ArrayList, plus (16 + (entries * 4bytes)) for array

■

For a 10,000 entry ArrayList, the overhead is ~40K

■
34

© 2013 IBM Corporation
Structure of ArrayList
ArrayList

array[10]

HashMap$Entry
Object value

HashMa$Entry
Object value

Object value
HashMap$Entry

Object value
HashMap$Entry

HashMap$Entry

HashMap$Entry

HashMap$Entry

HashMap$Entry

HashMap$Entry

35

HashMap$Entry

© 2013 IBM Corporation
Other types of “Collections”
public static void main(String[] args) {
StringBuffer myStringBuffer = new StringBuffer();
}
■

StringBuffers can be considered to be a type of collection
– “A thread-safe, mutable sequence of characters...
....
– Every string buffer has a capacity. As long as the length of the character sequence
contained in the string buffer does not exceed the capacity, it is not necessary to
allocate a new internal buffer array. If the internal buffer overflows, it is automatically
made larger.”
• Java Platform SE 6 API doc
•

■

Implementation is an array of char

■
■
■

Default capacity is 16 characters

■

Empty size is 72 bytes

■

Overhead is just 24bytes for StringBuffer

■

36

•

© 2013 IBM Corporation
Collections Summary

Collection

Empty Size

10K Overhead

HashSet

16

144

360K

HashMap

16

128

360K

Hashtable

11

104

360K

LinkedList

1

48

240K

ArrayList

10

88

40K

StringBuffer

37

Default Capacity

16

72

24

© 2013 IBM Corporation
Hash* collections vs others

■

Hash* collections are much larger
– x9 the size of an ArrayList
–

■

Additional size helps search/insert/delete performance
– Constant for Hash collections
– Linear for Array collections
• If there is no other index
•

■

Using the larger collection may be the right thing to do
– Important to know it is the right thing to do!
–

38

© 2013 IBM Corporation
Empty space in collections

■

Collections that contain empty space introduce additional overhead

■

Default collection size may not be appropriate for the amount of data being held
public static void main(String[] args) {
StringBuffer myStringBuffer = new StringBuffer(“MyString”);
}

■

0

32

64

96

Class

39

Locks

Class

■

Flags

Flags

Locks

128

count

160

192

224

256

288

320

352

384

416

448

480

512

value

Size charcharcharcharcharcharcharchar charcharcharcharcharcharcharchar
M Y
S T R I N G

544

576

608

640

java.lang.StringBuffer

char[]

StringBuffer default of 16 is inappropriate to hold a 9 character string
– 7 additional entries in char[]
– 112 byte additional overhead
© 2013 IBM Corporation
Expansion of collections

■

When collections hit the limit of their capacity, they expand
– Greatly increases capacity
– Greatly reduces “fill ratio”
–

■

Introduces additional collection overhead:

■
0

32

64

96

128

160

192

224

256

288

320

352

384

416

448

480

512

544

576

608

640

■

Class

40

Locks

Class

■

Flags

Flags

Locks

count

value

java.lang.StringBuffer

Size charcharcharcharcharcharcharchar charcharcharcharcharcharcharcharcharcharcharcharcharcharchar charcharcharcharcharcharcharchar
M Y
S T R I N G
T E X T
O F

char[]

Additional 16 char[] entries to hold single extra character
– 240 byte additional overhead
© 2013 IBM Corporation
Collections Summary

Collection

10K Overhead

Expansion

HashSet

16

144

360K

x2

HashMap

16

128

360K

x2

Hashtable

11

104

360K

x2 + 1

LinkedList

1

48

240K

+1

ArrayList

10

88

40K

x1.5

StringBuffer

41

Default Capacity Empty Size

16

72

24

x2

© 2013 IBM Corporation
Analyzing an Application

42

© 2013 IBM Corporation
Collections Summary

■

Collections exist in large numbers in many Java applications

■
■

Example: IBM WebSphere Application Server running PlantsByWebSphere
– When running a 5 user test load, and using 206MB of Java heap:
Hashtable
262,234 instances,
26.5MB of Java heap
WeakHashMap
19,562 instances
12.6MB of Java heap
HashMap
10,600 instances
2.3MB
of Java heap
ArrayList
9,530
instances
0.3MB
of Java heap
HashSet
1,551
instances
1.0MB
of Java heap
Vector
1,271
instances
0.04MB of Java heap
LinkedList
1,148
instances
0.1MB
of Java heap
TreeMap
299
instances
0.03MB of Java heap
306,195
42.9MB

■

16% of the Java heap used just for the collection objects !!

43

© 2013 IBM Corporation
Analyzing your Collections

■

44

Eclipse Memory Analyzer Tool (MAT) provides Collection analysis:

© 2013 IBM Corporation
Analyzing your Collections

■

45

Can select a specific Collection (java.util.Hashtable) or any

© 2013 IBM Corporation
Analyzing your Collections

■

46

Shows 127,016 empty java.util.Hashtable instances!

© 2013 IBM Corporation
Analyzing your Collections

■

47

You can “List objects” to see what they are

© 2013 IBM Corporation
Analyzing your Collections

■

48

java.util.Hashtable objects being used to store session data!

© 2013 IBM Corporation
Collection Analysis for PlantsByWebSphere Example

■

Collection

Number

Empty

% Empty

■

Hashtable

262,234

127,016

48.8

■

WeakHashMap

19,562

19,456

99.5

■

HashMap

10,600

7,599

71.7

ArrayList

9,530

4,588

48.1

HashSet

1,551

866

55.8

Vector

1,271

622

48.9

Total

304,748

160,156

52.6

■
■
■
■
■

Over 50% of collections are empty in our example

■

49

© 2013 IBM Corporation
Improvements in the JDK: WeakHashMap

■

WeakHashMap

19,562

19,456

99.5

■
■

12.5MB of memory being used for 19,456 empty instances of WeakHashMap

■
■
■
■
■

560 bytes per instance used for java.lang.ref.ReferenceQueue
– ReferenceQueue only required is there are elements in the WeakHashMap

■
■

Lazy allocation of ReferenceQueue saves 10.9MB in our example

■

50

© 2013 IBM Corporation
Techniques for minimizing memory

■

Lazy allocation of collections
– Don't create a collection until you have something to put into it

■
■

Don't create collections for a single Object!
– Just store the Object itself

■

Correct sizing of collections
– If only 2 entries will be stored, create with size 2:
HashMap myHashMap = new HashMap(2);
–

■

Avoid expansion of large collections due to x2 algorithm
– 32MB used to store 17MB of data

■
■

51

Collections do not shrink once expanded
– May need to reallocate if collection uses drops significantly
–
© 2013 IBM Corporation
Summary

■

There is significant overhead to your data!
– Some of which is on the “native” heap
–

■

Applications often have:
– The wrong collection types in use
– Empty or sparsely populated collections
–

■

Careful use of:
– Data structure layout
– Collection type selection
– Collection type default sizing
Can improve your memory efficiency

■
■

52

Eclipse Memory Analyzer Tool can identify inefficiencies in your application
– As well as show you the wider memory usage for code
© 2013 IBM Corporation
Read the Article:

From Java Code to Java Heap on IBM developerWorks:
http://www.ibm.com/developerworks/java/library/j-codetoheap/index.html
■

53

© 2013 IBM Corporation
Get the Slides:

From Java Code to Java Heap on Slideshare.net:
http://www.slideshare.net/cnbailey/java-code-to-java-heap

■

54

© 2013 IBM Corporation
References

■

Get Products and Technologies:
– IBM Monitoring and Diagnostic Tools for Java:
• https://www.ibm.com/developerworks/java/jdk/tools/
– Eclipse Memory Analyzer Tool:
• http://eclipse.org/mat/downloads.php
•

■

Learn:
– Debugging from Dumps:
• http://www.ibm.com/developerworks/java/library/j-memoryanalyzer/index.html
– Why the Memory Analyzer (with IBM Extensions) isn't just for memory leaks anymore:
• http://www.ibm.com/developerworks/websphere/techjournal/1103_supauth/1103_supauth

■

Discuss:
– IBM on Troubleshooting Java Applications Blog:
• https://www.ibm.com/developerworks/mydeveloperworks/blogs/troubleshootingjava/
– IBM Java Runtimes and SDKs Forum:
• http://www.ibm.com/developerworks/forums/forum.jspa?forumID=367&start=0

55

© 2013 IBM Corporation
Copyright and Trademarks

© IBM Corporation 2012. All Rights Reserved.

IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International
Business Machines Corp., and registered in many jurisdictions worldwide.

Other product and service names might be trademarks of IBM or other companies.

A current list of IBM trademarks is available on the Web – see the IBM “Copyright and
trademark information” page at URL: www.ibm.com/legal/copytrade.shtml

56

© 2013 IBM Corporation

Mais conteúdo relacionado

Mais procurados

코드 생성을 사용해 개발 속도 높이기 NDC2011
코드 생성을 사용해 개발 속도 높이기 NDC2011코드 생성을 사용해 개발 속도 높이기 NDC2011
코드 생성을 사용해 개발 속도 높이기 NDC2011
Esun Kim
 
remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal
Tobias Neitzel
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Christian Schneider
 
Anatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilitiesAnatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilities
DaveEdwards12
 

Mais procurados (20)

[보안PARTNERDAY] 모바일 리소스 보안 - 김동민
[보안PARTNERDAY] 모바일 리소스 보안 - 김동민[보안PARTNERDAY] 모바일 리소스 보안 - 김동민
[보안PARTNERDAY] 모바일 리소스 보안 - 김동민
 
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
[KGC 2012]Boost.asio를 이용한 네트웍 프로그래밍
 
Keep Code Left - How to write better code in almost any language
Keep Code Left - How to write better code in almost any languageKeep Code Left - How to write better code in almost any language
Keep Code Left - How to write better code in almost any language
 
코드 생성을 사용해 개발 속도 높이기 NDC2011
코드 생성을 사용해 개발 속도 높이기 NDC2011코드 생성을 사용해 개발 속도 높이기 NDC2011
코드 생성을 사용해 개발 속도 높이기 NDC2011
 
A little bit about code injection in WebApplication Frameworks (CVE-2018-1466...
A little bit about code injection in WebApplication Frameworks (CVE-2018-1466...A little bit about code injection in WebApplication Frameworks (CVE-2018-1466...
A little bit about code injection in WebApplication Frameworks (CVE-2018-1466...
 
remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal remote-method-guesser - BHUSA2021 Arsenal
remote-method-guesser - BHUSA2021 Arsenal
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacks
 
Exploitation techniques and fuzzing
Exploitation techniques and fuzzingExploitation techniques and fuzzing
Exploitation techniques and fuzzing
 
스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해
 
Buffer overflow
Buffer overflowBuffer overflow
Buffer overflow
 
Cpu steal time
Cpu steal timeCpu steal time
Cpu steal time
 
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
[NDC2017 : 박준철] Python 게임 서버 안녕하십니까 - 몬스터 슈퍼리그 게임 서버
[NDC2017 : 박준철] Python 게임 서버 안녕하십니까 - 몬스터 슈퍼리그 게임 서버[NDC2017 : 박준철] Python 게임 서버 안녕하십니까 - 몬스터 슈퍼리그 게임 서버
[NDC2017 : 박준철] Python 게임 서버 안녕하십니까 - 몬스터 슈퍼리그 게임 서버
 
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
[2013 CodeEngn Conference 09] Park.Sam - 게임 해킹툴의 변칙적 공격 기법 분석
 
Making MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid InfrastructureMaking MySQL highly available using Oracle Grid Infrastructure
Making MySQL highly available using Oracle Grid Infrastructure
 
Practical API Security - PyCon 2018
Practical API Security - PyCon 2018Practical API Security - PyCon 2018
Practical API Security - PyCon 2018
 
Anatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilitiesAnatomy of business logic vulnerabilities
Anatomy of business logic vulnerabilities
 
Windows Attacks AT is the new black
Windows Attacks   AT is the new blackWindows Attacks   AT is the new black
Windows Attacks AT is the new black
 
[1113 박민수]a star_알고리즘
[1113 박민수]a star_알고리즘[1113 박민수]a star_알고리즘
[1113 박민수]a star_알고리즘
 
Ibm power ha v7 technical deep dive workshop
Ibm power ha v7 technical deep dive workshopIbm power ha v7 technical deep dive workshop
Ibm power ha v7 technical deep dive workshop
 

Destaque

Legal and ethical considerations redone
Legal and ethical considerations   redoneLegal and ethical considerations   redone
Legal and ethical considerations redone
Nicole174
 
Interactive media applications
Interactive media applicationsInteractive media applications
Interactive media applications
Nicole174
 

Destaque (20)

A real-time architecture using Hadoop & Storm - Nathan Bijnens & Geert Van La...
A real-time architecture using Hadoop & Storm - Nathan Bijnens & Geert Van La...A real-time architecture using Hadoop & Storm - Nathan Bijnens & Geert Van La...
A real-time architecture using Hadoop & Storm - Nathan Bijnens & Geert Van La...
 
Are you better than a coin toss? - Richard Warbuton & John Oliver (jClarity)
Are you better than a coin toss?  - Richard Warbuton & John Oliver (jClarity)Are you better than a coin toss?  - Richard Warbuton & John Oliver (jClarity)
Are you better than a coin toss? - Richard Warbuton & John Oliver (jClarity)
 
What makes Groovy Groovy - Guillaume Laforge (Pivotal)
What makes Groovy Groovy  - Guillaume Laforge (Pivotal)What makes Groovy Groovy  - Guillaume Laforge (Pivotal)
What makes Groovy Groovy - Guillaume Laforge (Pivotal)
 
Little words of wisdom for the developer - Guillaume Laforge (Pivotal)
Little words of wisdom for the developer - Guillaume Laforge (Pivotal)Little words of wisdom for the developer - Guillaume Laforge (Pivotal)
Little words of wisdom for the developer - Guillaume Laforge (Pivotal)
 
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
Designing and Building a Graph Database Application - Ian Robinson (Neo Techn...
 
Legal and ethical considerations redone
Legal and ethical considerations   redoneLegal and ethical considerations   redone
Legal and ethical considerations redone
 
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
 
Are Hypermedia APIs Just Hype? - Aaron Phethean (Temenos) & Daniel Feist (Mul...
Are Hypermedia APIs Just Hype? - Aaron Phethean (Temenos) & Daniel Feist (Mul...Are Hypermedia APIs Just Hype? - Aaron Phethean (Temenos) & Daniel Feist (Mul...
Are Hypermedia APIs Just Hype? - Aaron Phethean (Temenos) & Daniel Feist (Mul...
 
Interactive media applications
Interactive media applicationsInteractive media applications
Interactive media applications
 
Databases and agile development - Dwight Merriman (MongoDB)
Databases and agile development - Dwight Merriman (MongoDB)Databases and agile development - Dwight Merriman (MongoDB)
Databases and agile development - Dwight Merriman (MongoDB)
 
Streams and Things - Darach Ennis (Ubiquiti Networks)
Streams and Things - Darach Ennis (Ubiquiti Networks)Streams and Things - Darach Ennis (Ubiquiti Networks)
Streams and Things - Darach Ennis (Ubiquiti Networks)
 
How Windows 10 will change the way we use devices
How Windows 10 will change the way we use devicesHow Windows 10 will change the way we use devices
How Windows 10 will change the way we use devices
 
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
Packed Objects: Fast Talking Java Meets Native Code - Steve Poole (IBM)
 
Bringing your app to the web with Dart - Chris Buckett (Entity Group)
Bringing your app to the web with Dart - Chris Buckett (Entity Group)Bringing your app to the web with Dart - Chris Buckett (Entity Group)
Bringing your app to the web with Dart - Chris Buckett (Entity Group)
 
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)What You Need to Know About Lambdas - Jamie Allen (Typesafe)
What You Need to Know About Lambdas - Jamie Allen (Typesafe)
 
Garbage Collection: the Useful Parts - Martijn Verburg & Dr John Oliver (jCla...
Garbage Collection: the Useful Parts - Martijn Verburg & Dr John Oliver (jCla...Garbage Collection: the Useful Parts - Martijn Verburg & Dr John Oliver (jCla...
Garbage Collection: the Useful Parts - Martijn Verburg & Dr John Oliver (jCla...
 
How Hailo fuels its growth using NoSQL storage and analytics - Dave Gardner (...
How Hailo fuels its growth using NoSQL storage and analytics - Dave Gardner (...How Hailo fuels its growth using NoSQL storage and analytics - Dave Gardner (...
How Hailo fuels its growth using NoSQL storage and analytics - Dave Gardner (...
 
The state of the art biorepository at ILRI
The state of the art biorepository at ILRIThe state of the art biorepository at ILRI
The state of the art biorepository at ILRI
 
Lambda Expressions: Myths and Mistakes - Richard Warburton (jClarity)
Lambda Expressions: Myths and Mistakes - Richard Warburton (jClarity)Lambda Expressions: Myths and Mistakes - Richard Warburton (jClarity)
Lambda Expressions: Myths and Mistakes - Richard Warburton (jClarity)
 
Big data from the LHC commissioning: practical lessons from big science - Sim...
Big data from the LHC commissioning: practical lessons from big science - Sim...Big data from the LHC commissioning: practical lessons from big science - Sim...
Big data from the LHC commissioning: practical lessons from big science - Sim...
 

Semelhante a From Java Code to Java Heap: Understanding the Memory Usage of Your App - Chris Bailey (IBM)

JavaOne 2014: Java Debugging
JavaOne 2014: Java DebuggingJavaOne 2014: Java Debugging
JavaOne 2014: Java Debugging
Chris Bailey
 
Operational Intelligence Using Hadoop
Operational Intelligence Using HadoopOperational Intelligence Using Hadoop
Operational Intelligence Using Hadoop
DataWorks Summit
 

Semelhante a From Java Code to Java Heap: Understanding the Memory Usage of Your App - Chris Bailey (IBM) (20)

JavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient JavaJavaOne 2013: Memory Efficient Java
JavaOne 2013: Memory Efficient Java
 
JavaOne 2014: Java Debugging
JavaOne 2014: Java DebuggingJavaOne 2014: Java Debugging
JavaOne 2014: Java Debugging
 
Apache Spark Performance Observations
Apache Spark Performance ObservationsApache Spark Performance Observations
Apache Spark Performance Observations
 
IBM Runtimes Performance Observations with Apache Spark
IBM Runtimes Performance Observations with Apache SparkIBM Runtimes Performance Observations with Apache Spark
IBM Runtimes Performance Observations with Apache Spark
 
Investigation report on 64 bit support and some of new features in aosp master
Investigation report on 64 bit support and some of new features in aosp masterInvestigation report on 64 bit support and some of new features in aosp master
Investigation report on 64 bit support and some of new features in aosp master
 
How to Optimize Hortonworks Apache Spark ML Workloads on Modern Processors
How to Optimize Hortonworks Apache Spark ML Workloads on Modern Processors How to Optimize Hortonworks Apache Spark ML Workloads on Modern Processors
How to Optimize Hortonworks Apache Spark ML Workloads on Modern Processors
 
Optimizing Hortonworks Apache Spark machine learning workloads for contempora...
Optimizing Hortonworks Apache Spark machine learning workloads for contempora...Optimizing Hortonworks Apache Spark machine learning workloads for contempora...
Optimizing Hortonworks Apache Spark machine learning workloads for contempora...
 
Advanced High-Performance Computing Features of the OpenPOWER ISA
 Advanced High-Performance Computing Features of the OpenPOWER ISA Advanced High-Performance Computing Features of the OpenPOWER ISA
Advanced High-Performance Computing Features of the OpenPOWER ISA
 
Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013Debugging Native heap OOM - JavaOne 2013
Debugging Native heap OOM - JavaOne 2013
 
Raising ux bar with offline first design
Raising ux bar with offline first designRaising ux bar with offline first design
Raising ux bar with offline first design
 
Debugging Java from Dumps
Debugging Java from DumpsDebugging Java from Dumps
Debugging Java from Dumps
 
Operational Intelligence Using Hadoop
Operational Intelligence Using HadoopOperational Intelligence Using Hadoop
Operational Intelligence Using Hadoop
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
Big data should be simple
Big data should be simpleBig data should be simple
Big data should be simple
 
High Performance With Java
High Performance With JavaHigh Performance With Java
High Performance With Java
 
Ceph
CephCeph
Ceph
 
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
Ceph: Open Source Storage Software Optimizations on Intel® Architecture for C...
 
Webinar: High Performance MongoDB Applications with IBM POWER8
Webinar: High Performance MongoDB Applications with IBM POWER8Webinar: High Performance MongoDB Applications with IBM POWER8
Webinar: High Performance MongoDB Applications with IBM POWER8
 
Deep Dive into Project Tungsten: Bringing Spark Closer to Bare Metal-(Josh Ro...
Deep Dive into Project Tungsten: Bringing Spark Closer to Bare Metal-(Josh Ro...Deep Dive into Project Tungsten: Bringing Spark Closer to Bare Metal-(Josh Ro...
Deep Dive into Project Tungsten: Bringing Spark Closer to Bare Metal-(Josh Ro...
 
From Java code to Java heap: Understanding and optimizing your application's ...
From Java code to Java heap: Understanding and optimizing your application's ...From Java code to Java heap: Understanding and optimizing your application's ...
From Java code to Java heap: Understanding and optimizing your application's ...
 

Mais de jaxLondonConference

Mais de jaxLondonConference (20)

Conflict Free Replicated Data-types in Eventually Consistent Systems - Joel J...
Conflict Free Replicated Data-types in Eventually Consistent Systems - Joel J...Conflict Free Replicated Data-types in Eventually Consistent Systems - Joel J...
Conflict Free Replicated Data-types in Eventually Consistent Systems - Joel J...
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)
 
Why other ppl_dont_get_it
Why other ppl_dont_get_itWhy other ppl_dont_get_it
Why other ppl_dont_get_it
 
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
Introducing Vert.x 2.0 - Taking polyglot application development to the next ...
 
How Java got its Mojo Back - James Governor (Redmonk)
How Java got its Mojo Back - James Governor (Redmonk)					How Java got its Mojo Back - James Governor (Redmonk)
How Java got its Mojo Back - James Governor (Redmonk)
 
Java Testing With Spock - Ken Sipe (Trexin Consulting)
Java Testing With Spock - Ken Sipe (Trexin Consulting)Java Testing With Spock - Ken Sipe (Trexin Consulting)
Java Testing With Spock - Ken Sipe (Trexin Consulting)
 
Big Events, Mob Scale - Darach Ennis (Push Technology)
Big Events, Mob Scale - Darach Ennis (Push Technology)Big Events, Mob Scale - Darach Ennis (Push Technology)
Big Events, Mob Scale - Darach Ennis (Push Technology)
 
The Java Virtual Machine is Over - The Polyglot VM is here - Marcus Lagergren...
The Java Virtual Machine is Over - The Polyglot VM is here - Marcus Lagergren...The Java Virtual Machine is Over - The Polyglot VM is here - Marcus Lagergren...
The Java Virtual Machine is Over - The Polyglot VM is here - Marcus Lagergren...
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
 
Exploring the Talend unified Big Data toolset for sentiment analysis - Ben Br...
Exploring the Talend unified Big Data toolset for sentiment analysis - Ben Br...Exploring the Talend unified Big Data toolset for sentiment analysis - Ben Br...
Exploring the Talend unified Big Data toolset for sentiment analysis - Ben Br...
 
The Curious Clojurist - Neal Ford (Thoughtworks)
The Curious Clojurist - Neal Ford (Thoughtworks)The Curious Clojurist - Neal Ford (Thoughtworks)
The Curious Clojurist - Neal Ford (Thoughtworks)
 
TDD at scale - Mash Badar (UBS)
TDD at scale - Mash Badar (UBS)TDD at scale - Mash Badar (UBS)
TDD at scale - Mash Badar (UBS)
 
Run Your Java Code on Cloud Foundry - Andy Piper (Pivotal)
Run Your Java Code on Cloud Foundry - Andy Piper (Pivotal)Run Your Java Code on Cloud Foundry - Andy Piper (Pivotal)
Run Your Java Code on Cloud Foundry - Andy Piper (Pivotal)
 
Scaling Scala to the database - Stefan Zeiger (Typesafe)
Scaling Scala to the database - Stefan Zeiger (Typesafe)Scaling Scala to the database - Stefan Zeiger (Typesafe)
Scaling Scala to the database - Stefan Zeiger (Typesafe)
 
Put your Java apps to sleep? Find out how - John Matthew Holt (Waratek)
Put your Java apps to sleep? Find out how - John Matthew Holt (Waratek)Put your Java apps to sleep? Find out how - John Matthew Holt (Waratek)
Put your Java apps to sleep? Find out how - John Matthew Holt (Waratek)
 
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
Project Lambda: Functional Programming Constructs in Java - Simon Ritter (Ora...
 
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
Do You Like Coffee with Your dessert? Java and the Raspberry Pi - Simon Ritte...
 
Large scale, interactive ad-hoc queries over different datastores with Apache...
Large scale, interactive ad-hoc queries over different datastores with Apache...Large scale, interactive ad-hoc queries over different datastores with Apache...
Large scale, interactive ad-hoc queries over different datastores with Apache...
 
Designing Resilient Application Platforms with Apache Cassandra - Hayato Shim...
Designing Resilient Application Platforms with Apache Cassandra - Hayato Shim...Designing Resilient Application Platforms with Apache Cassandra - Hayato Shim...
Designing Resilient Application Platforms with Apache Cassandra - Hayato Shim...
 
Practical Performance: Understand the Performance of Your Application - Chris...
Practical Performance: Understand the Performance of Your Application - Chris...Practical Performance: Understand the Performance of Your Application - Chris...
Practical Performance: Understand the Performance of Your Application - Chris...
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

From Java Code to Java Heap: Understanding the Memory Usage of Your App - Chris Bailey (IBM)

  • 1. 29th October 2013 From Java Code to Java Heap Understanding the Memory Usage of Your Application Document number © 2013 IBM Corporation
  • 2. Important Disclaimers THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR INFRASTRUCTURE DIFFERENCES. ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE. IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE. IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF: - CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS 2 © 2013 IBM Corporation
  • 3. Introduction to the speaker ■ 13 years experience developing and deploying Java SDKs ■ Recent work focus: – Java applications in the cloud – Java usability and quality – Debugging tools and capabilities – Requirements gathering – Highly resilient and scalable deployments ■ My contact information: – baileyc@uk.ibm.com – http://www.linkedin.com/in/chrisbaileyibm – http://www.slideshare.net/cnbailey/ 3 © 2013 IBM Corporation
  • 4. Goals of this talk ■ Deliver an insight into the memory usage of Java code: – The overhead of Java Objects – The cost of delegation – The overhead of the common Java Collections – – ■ Provide you with information to: – Choose the right collection types – Analyze your application for memory inefficiencies 4 © 2013 IBM Corporation
  • 5. Agenda ■ Introduction to Memory Management ■ ■ Anatomy of a Java object ■ ■ Understanding Java Collections ■ ■ 5 Analyzing your application © 2013 IBM Corporation
  • 6. Java Memory Management 6 © 2013 IBM Corporation
  • 7. Understanding Java Memory Management ■ Java runs as a Operating System (OS) level process, with the restrictions that the OS imposes: 0 GB 2 GB ■ ■ ■ OS and C-Runtime JVM Native Heap 0x0 0x40000000 0x80000000 -Xmx 4 GB Java Heap(s) 0xC0000000 ■ 32 bit architecture and/or OS gives 4GB of process address space – Much, much larger for 64bit ■ Some memory is used by the OS and C-language runtime – Area left over is termed the “User Space” ■ Some memory is used by the Java Virtual Machine (JVM) runtime ■ 0xFFFFFFFF Some of the rest is used for the Java Heap(s) …and some is left over: the “native” heap ■ 7 Native heap is usually measured including the JVM memory usage © 2013 IBM Corporation
  • 8. “Native Heap” Usage ■ ■ A number of Java objects are underpinned by OS level resources – Therefore have associated “native” heap memory – Example: java.lang.Thread – – Java Heap 8 Native Heap © 2013 IBM Corporation
  • 9. 32bit User Space Available to the Java Process  On Windows (default): 0 GB 2 GB 1 GB User Space 0x0 0x40000000 4 GB 3 GB Kernel Space 0xC0000000 0x80000000 Libraries 0xFFFFFFFF  On Windows (/3GB): 0 GB 2 GB 1 GB User Space 0x0 9 0x40000000 4 GB 3 GB Kernel Space 0xC0000000 0x80000000 Libraries 0xFFFFFFFF © 2013 IBM Corporation
  • 10. 32bit User Space Available to the Java Process  On Linux (default): 0 GB 2 GB 1 GB User Space 0x0 0x40000000 4 GB 3 GB Kernel 0x80000000 0xC0000000 0xFFFFFFFF  On Linux (Hugemem Kernel): Separate address space for the Kernel 0 GB 1 GB 2 GB 3 GB 4 GB User Space 0x0 10 0x40000000 0x80000000 0xC0000000 0xFFFFFFFF © 2013 IBM Corporation
  • 11. 64 bit User Space Available to the Java Process Platform User Space Windows AMD64 Windows Itanium 7152 GiB Linux AMD64 500 GiB Linux PPC64 1648 GiB Linux 390 64 8 EiB AIX PPC64 11 8192 GiB 448 PiB © 2013 IBM Corporation
  • 12. Anatomy of a Java Object 12 © 2013 IBM Corporation
  • 13. Anatomy of a Java Object public class CreateInteger { public static void main(String[] args) { Integer myInteger = new Integer(10); } } • ■ Question: An int (eg. 10) is 32 bits, but how much bigger is an Integer object? (for a 32bit platform) (a) x1 (b) x1.5 (c) x2 (d) x3 ■ 13 Answer is option (e) x4 !! © 2013 IBM Corporation
  • 14. Anatomy of a Java Object public static void main(String[] args) { Integer myInteger = new Integer(10); }   Typical Object Metadata: – Class: – Flags: – Lock: – Size: 0 pointer to class information shape, hash code, etc flatlock or pointer to inflated monitor the length of the array (arrays only) 32 64 96 128 Class pointer Locks Flags Locks Size 192 224 256 288 320 Java Object int: 10 Class pointer 14 Flags 160 int: 10 Array Object © 2013 IBM Corporation
  • 15. Anatomy of a Java Object: 64bit public static void main(String[] args) { Integer myInteger = new Integer(10); }   Typical Object Metadata: – Class: – Flags: – Lock: – Size: 0 pointer to class information shape, hash code, etc flatlock or pointer to inflated monitor the length of the array (arrays only) 32 64 96 128 Class pointer pointer Class Flags Locks Flags int Class pointer pointer Class Flags Locks Flags Size 160 Locks int 192 224 256 288 Java Object int, eg. 10 Locks 320 Size int, eg. 10 Array Object  Size ratio of an Integer object to an int value becomes 9:1 !! 15 © 2013 IBM Corporation
  • 16. Object Field Sizes Field Type Field size/bits 32bit Process Object Array 64bit Process Object Array boolean 32 8 32 8 byte 32 8 32 8 char 32 16 32 16 short 32 16 32 16 int 32 32 32 32 float 32 32 32 32 long 64 64 64 64 double 64 64 64 64 Objects 32 32 64* 64 *32bits if Compressed References / Compressed Oops enabled 16 © 2013 IBM Corporation
  • 17. Compressed References and CompressedOOPs ■ Migrating an application from 32bit to 64bit Java increases memory usage: – Java heap usage increases by ~70% – “Native” heap usage increases by ~90% – ■ Compressed References / Compressed Ordinary Object Pointers – Use bit shifted, relative addressing for 64bit Java heaps – Object metadata and Objects references become 32bits – ■ Using compressed technologies does remove Java heap usage increase ■ Using compressed technologies does not remove “native” heap usage increase – – 17 © 2013 IBM Corporation
  • 18. Anatomy of a Java Object: 64bit with Compressed Refs/OOPs public static void main(String[] args) { Integer myInteger = new Integer(10); }   Typical Object Metadata: – Class: – Flags: – Lock: – Size: 0 pointer to class information shape, hash code, etc flatlock or pointer to inflated monitor the length of the array (arrays only) 32 64 96 128 Class pointer pointer Class Flags int Class pointer pointer Class Flags 18 Locks Flags Locks Flags Size 160 Locks int Locks 192 224 256 288 320 Java Object int, eg. 10 Size int, eg. 10 Array Object © 2013 IBM Corporation
  • 19. Allocating (slightly) more complex objects public static void main(String[] args) { String myString = new String("MyString"); }  Good object orientated design encourages encapsulation and delegation  Example: java.lang.String encapsulates a character array: 0 32 64 96 128 Class pointer Flags Locks hash Class pointer Flags Locks Size 160 count char M char Y 192 offset char S char T 224 256 char I 320 java.lang.String value char R 288 char N char G char[]  128 bits of char data, stored in 480 bits of memory, size ratio of x3.75 – Maximum overhead would be x24 for a single character! 19 © 2013 IBM Corporation
  • 20. Understanding Java Collections 20 © 2013 IBM Corporation
  • 21. Java Collections ■ java.util.HashSet ■ ■ ■ ■ ■ ■ java.util.HashMap java.util.Hashtable java.util.LinkedList java.util.ArrayList Increasing Size Each Java Collection has a different level of function, and memory overhead Increasing Function ■ Using the wrong type of collection can incur significant additional memory overhead – ■ 21 © 2013 IBM Corporation
  • 22. HashMap public static void main(String[] args) { HashMap myHashMap = new HashMap(); } ■ Implementation of the Map interface: – “An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.“ • Java Platform SE 6 API doc • ■ Implementation is an array of HashMap$Entry objects: ■ ■ ■ ■ Default capacity is 16 entries ■ Empty size is 128 bytes ■ Overhead is 48 bytes for HashMap, plus (16 + (entries * 4bytes)) for array – Plus overhead of HashMap$Entry objects 22 © 2013 IBM Corporation
  • 24. HashMap$Entry ■ Each HashMap$Entry contains: – int KeyHash – Object next – Object key – Object value – ■ Additional 32bytes per key ↔ value entry ■ Overhead of HashMap is therefore: – 48 bytes, plus 36 bytes per entry – ■ For a 10,000 entry HashMap, the overhead is ~360K – 24 © 2013 IBM Corporation
  • 25. HashMap Structure HashMap array[16] HashMap$Entry HashMap$Entry HashMap$Entry Object key Object key Object key Object value Object value Object value HashMap$Entry Object key Object value HashMap$Entry Object key Object value 25 © 2013 IBM Corporation
  • 26. Hashtable public static void main(String[] args) { Hashtable myHashtable = new Hashtable(); } ■ Implementation of the Map interface: – “This class implements a hashtable, which maps keys to values. Any non-null object can be used as a key or as a value.“ • Java Platform SE 6 API doc • ■ Implementation is an array of Hashtable$Entry objects: ■ ■ ■ ■ Default capacity is 11 entries ■ Empty size is 104 bytes ■ Overhead is 40 bytes for Hashtable, plus (16 + (entries * 4bytes)) for array – Plus overhead of Hashtable$Entry objects 26 © 2013 IBM Corporation
  • 28. Hashtable$Entry ■ Each Hashtable$Entry contains: – int KeyHash – Object next – Object key – Object value – ■ Additional 32bytes per key ↔ value entry ■ Overhead of Hashtable is therefore: – 40 bytes, plus 36 bytes per entry – ■ For a 10,000 entry Hashtable, the overhead is ~360K – 28 © 2013 IBM Corporation
  • 29. HashTable Structure HashTable array[11] HashTable$Entry HashTable$Entry HashTable$Entry Object key Object key Object key Object value Object value Object value HashTable$Entry Object key Object value HashTable$Entry Object key Object value 29 © 2013 IBM Corporation
  • 30. LinkedList public static void main(String[] args) { LinkedList myLinkedList = new LinkedList(); } ■ Linked list implementation of the List interface: – “An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list. – Unlike sets, lists typically allow duplicate elements. “ • Java Platform SE 6 API doc • ■ Implementation is a linked list of LinkedList$Entry objects (or LinkedList$Link): ■ ■ ■ Default capacity is 1 entry ■ Empty size is 48 bytes ■ Overhead is 24 bytes for LinkedList, plus overhead of LinkedList$Entry/Link objects 30 © 2013 IBM Corporation
  • 32. LinkedList$Entry / Link ■ Each LinkedList$Entry contains: – Object previous – Object next – Object entry – ■ Additional 24bytes per entry ■ Overhead of LinkedList is therefore: – 24 bytes, plus 24 bytes per entry – ■ For a 10,000 entry LinkedList, the overhead is ~240K 32 © 2013 IBM Corporation
  • 34. ArrayList public static void main(String[] args) { ArrayList myArrayList = new ArrayList(); } ■ A resizeable array instance of the List interface: – “An ordered collection (also known as a sequence). The user of this interface has precise control over where in the list each element is inserted. The user can access elements by their integer index (position in the list), and search for elements in the list. – Unlike sets, lists typically allow duplicate elements. “ • Java Platform SE 6 API doc ■ ■ Implementation is an array of Object: ■ ■ ■ Default capacity is 10 entries ■ Empty size is 88 bytes ■ Overhead is 32bytes for ArrayList, plus (16 + (entries * 4bytes)) for array ■ For a 10,000 entry ArrayList, the overhead is ~40K ■ 34 © 2013 IBM Corporation
  • 35. Structure of ArrayList ArrayList array[10] HashMap$Entry Object value HashMa$Entry Object value Object value HashMap$Entry Object value HashMap$Entry HashMap$Entry HashMap$Entry HashMap$Entry HashMap$Entry HashMap$Entry 35 HashMap$Entry © 2013 IBM Corporation
  • 36. Other types of “Collections” public static void main(String[] args) { StringBuffer myStringBuffer = new StringBuffer(); } ■ StringBuffers can be considered to be a type of collection – “A thread-safe, mutable sequence of characters... .... – Every string buffer has a capacity. As long as the length of the character sequence contained in the string buffer does not exceed the capacity, it is not necessary to allocate a new internal buffer array. If the internal buffer overflows, it is automatically made larger.” • Java Platform SE 6 API doc • ■ Implementation is an array of char ■ ■ ■ Default capacity is 16 characters ■ Empty size is 72 bytes ■ Overhead is just 24bytes for StringBuffer ■ 36 • © 2013 IBM Corporation
  • 37. Collections Summary Collection Empty Size 10K Overhead HashSet 16 144 360K HashMap 16 128 360K Hashtable 11 104 360K LinkedList 1 48 240K ArrayList 10 88 40K StringBuffer 37 Default Capacity 16 72 24 © 2013 IBM Corporation
  • 38. Hash* collections vs others ■ Hash* collections are much larger – x9 the size of an ArrayList – ■ Additional size helps search/insert/delete performance – Constant for Hash collections – Linear for Array collections • If there is no other index • ■ Using the larger collection may be the right thing to do – Important to know it is the right thing to do! – 38 © 2013 IBM Corporation
  • 39. Empty space in collections ■ Collections that contain empty space introduce additional overhead ■ Default collection size may not be appropriate for the amount of data being held public static void main(String[] args) { StringBuffer myStringBuffer = new StringBuffer(“MyString”); } ■ 0 32 64 96 Class 39 Locks Class ■ Flags Flags Locks 128 count 160 192 224 256 288 320 352 384 416 448 480 512 value Size charcharcharcharcharcharcharchar charcharcharcharcharcharcharchar M Y S T R I N G 544 576 608 640 java.lang.StringBuffer char[] StringBuffer default of 16 is inappropriate to hold a 9 character string – 7 additional entries in char[] – 112 byte additional overhead © 2013 IBM Corporation
  • 40. Expansion of collections ■ When collections hit the limit of their capacity, they expand – Greatly increases capacity – Greatly reduces “fill ratio” – ■ Introduces additional collection overhead: ■ 0 32 64 96 128 160 192 224 256 288 320 352 384 416 448 480 512 544 576 608 640 ■ Class 40 Locks Class ■ Flags Flags Locks count value java.lang.StringBuffer Size charcharcharcharcharcharcharchar charcharcharcharcharcharcharcharcharcharcharcharcharcharchar charcharcharcharcharcharcharchar M Y S T R I N G T E X T O F char[] Additional 16 char[] entries to hold single extra character – 240 byte additional overhead © 2013 IBM Corporation
  • 41. Collections Summary Collection 10K Overhead Expansion HashSet 16 144 360K x2 HashMap 16 128 360K x2 Hashtable 11 104 360K x2 + 1 LinkedList 1 48 240K +1 ArrayList 10 88 40K x1.5 StringBuffer 41 Default Capacity Empty Size 16 72 24 x2 © 2013 IBM Corporation
  • 42. Analyzing an Application 42 © 2013 IBM Corporation
  • 43. Collections Summary ■ Collections exist in large numbers in many Java applications ■ ■ Example: IBM WebSphere Application Server running PlantsByWebSphere – When running a 5 user test load, and using 206MB of Java heap: Hashtable 262,234 instances, 26.5MB of Java heap WeakHashMap 19,562 instances 12.6MB of Java heap HashMap 10,600 instances 2.3MB of Java heap ArrayList 9,530 instances 0.3MB of Java heap HashSet 1,551 instances 1.0MB of Java heap Vector 1,271 instances 0.04MB of Java heap LinkedList 1,148 instances 0.1MB of Java heap TreeMap 299 instances 0.03MB of Java heap 306,195 42.9MB ■ 16% of the Java heap used just for the collection objects !! 43 © 2013 IBM Corporation
  • 44. Analyzing your Collections ■ 44 Eclipse Memory Analyzer Tool (MAT) provides Collection analysis: © 2013 IBM Corporation
  • 45. Analyzing your Collections ■ 45 Can select a specific Collection (java.util.Hashtable) or any © 2013 IBM Corporation
  • 46. Analyzing your Collections ■ 46 Shows 127,016 empty java.util.Hashtable instances! © 2013 IBM Corporation
  • 47. Analyzing your Collections ■ 47 You can “List objects” to see what they are © 2013 IBM Corporation
  • 48. Analyzing your Collections ■ 48 java.util.Hashtable objects being used to store session data! © 2013 IBM Corporation
  • 49. Collection Analysis for PlantsByWebSphere Example ■ Collection Number Empty % Empty ■ Hashtable 262,234 127,016 48.8 ■ WeakHashMap 19,562 19,456 99.5 ■ HashMap 10,600 7,599 71.7 ArrayList 9,530 4,588 48.1 HashSet 1,551 866 55.8 Vector 1,271 622 48.9 Total 304,748 160,156 52.6 ■ ■ ■ ■ ■ Over 50% of collections are empty in our example ■ 49 © 2013 IBM Corporation
  • 50. Improvements in the JDK: WeakHashMap ■ WeakHashMap 19,562 19,456 99.5 ■ ■ 12.5MB of memory being used for 19,456 empty instances of WeakHashMap ■ ■ ■ ■ ■ 560 bytes per instance used for java.lang.ref.ReferenceQueue – ReferenceQueue only required is there are elements in the WeakHashMap ■ ■ Lazy allocation of ReferenceQueue saves 10.9MB in our example ■ 50 © 2013 IBM Corporation
  • 51. Techniques for minimizing memory ■ Lazy allocation of collections – Don't create a collection until you have something to put into it ■ ■ Don't create collections for a single Object! – Just store the Object itself ■ Correct sizing of collections – If only 2 entries will be stored, create with size 2: HashMap myHashMap = new HashMap(2); – ■ Avoid expansion of large collections due to x2 algorithm – 32MB used to store 17MB of data ■ ■ 51 Collections do not shrink once expanded – May need to reallocate if collection uses drops significantly – © 2013 IBM Corporation
  • 52. Summary ■ There is significant overhead to your data! – Some of which is on the “native” heap – ■ Applications often have: – The wrong collection types in use – Empty or sparsely populated collections – ■ Careful use of: – Data structure layout – Collection type selection – Collection type default sizing Can improve your memory efficiency ■ ■ 52 Eclipse Memory Analyzer Tool can identify inefficiencies in your application – As well as show you the wider memory usage for code © 2013 IBM Corporation
  • 53. Read the Article: From Java Code to Java Heap on IBM developerWorks: http://www.ibm.com/developerworks/java/library/j-codetoheap/index.html ■ 53 © 2013 IBM Corporation
  • 54. Get the Slides: From Java Code to Java Heap on Slideshare.net: http://www.slideshare.net/cnbailey/java-code-to-java-heap ■ 54 © 2013 IBM Corporation
  • 55. References ■ Get Products and Technologies: – IBM Monitoring and Diagnostic Tools for Java: • https://www.ibm.com/developerworks/java/jdk/tools/ – Eclipse Memory Analyzer Tool: • http://eclipse.org/mat/downloads.php • ■ Learn: – Debugging from Dumps: • http://www.ibm.com/developerworks/java/library/j-memoryanalyzer/index.html – Why the Memory Analyzer (with IBM Extensions) isn't just for memory leaks anymore: • http://www.ibm.com/developerworks/websphere/techjournal/1103_supauth/1103_supauth ■ Discuss: – IBM on Troubleshooting Java Applications Blog: • https://www.ibm.com/developerworks/mydeveloperworks/blogs/troubleshootingjava/ – IBM Java Runtimes and SDKs Forum: • http://www.ibm.com/developerworks/forums/forum.jspa?forumID=367&start=0 55 © 2013 IBM Corporation
  • 56. Copyright and Trademarks © IBM Corporation 2012. All Rights Reserved. IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., and registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web – see the IBM “Copyright and trademark information” page at URL: www.ibm.com/legal/copytrade.shtml 56 © 2013 IBM Corporation