1 copyright © 2012, oracle and/or its affiliates. all rights reserved. · 2012-11-12 · jax-rs...
TRANSCRIPT
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 1
The dark art of performance tuning or how to become a performance hero without spending a penny on tools. Leonid Igolnik Vice President of Product Development
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 3
Housekeeping
Twitter @JDD_Krakow http://twitter.com/JDD_Krakow Twitter hashtag #JDD_Krakow Facebook https://www.facebook.com/JDDconf Follow me at @ligolnik
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 4
Agenda
About me
About you
Performance tuning and related concepts
Live demos and debugging
Further reading, talks etc
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 5
About me
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 6
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 7
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 8
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 9
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 10
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 11
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 12
In the next 90 minutes
We will process 4,853,000 transactions or about 898/sec 720 new jobs will be posted 29,500 job applications will be submitted 726 people will be hired
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 13
About you
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 14
Are you a:
Developer Team/Lead technical lead Manager Architect Executive
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 15
I build products that:
Are built in Java Are not built in Java Are not built in Java but run on the JVM Are assembled from different technologies including Java Power a business Are web based applications Have to scale and run fast
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 16
My development workstation runs
Windows Linux OS X Other
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 17
My applications are deployed on
Windows Linux Other Unix flavor Mac OS X ????? Other
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 18
Applications I build are used by:
100’s of users every day 1000’s of users every day 10,000’s of users every day 100,000’s of users every day 1,000,000’s of users every day I don’t know
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 19
Performance tuning
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 20
Performance Tuning http://en.wikipedia.org/wiki/Performance_tuning
“Performance tuning is the improvement of system performance. The motivation for such activity is called a performance problem, which can be real or anticipated. Most systems will respond to increased load with some degree of decreasing performance. A system’s ability to accept higher load is called scalability, and modifying a system to handle a higher load is synonymous to performance tuning.”
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 21
Performance Tuning http://en.wikipedia.org/wiki/Performance_tuning
“Performance tuning is the improvement of system performance. The motivation for such activity is called a performance problem, which can be real or anticipated. Most systems will respond to increased load with some degree of decreasing performance. A system’s ability to accept higher load is called scalability, and modifying a system to handle a higher load is synonymous to performance tuning.”
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 22
Performance Tuning http://en.wikipedia.org/wiki/Performance_tuning
“Performance tuning is the improvement of system performance. The motivation for such activity is called a performance problem, which can be real or anticipated. Most systems will respond to increased load with some degree of decreasing performance. A system’s ability to accept higher load is called scalability, and modifying a system to handle a higher load is synonymous to performance tuning.”
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 23
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 24
Establish acceptable behavior
Measure system performance
Identify critical parts aka
bottlenecks Modify the
system
Measure the performance
after the change
Systematic tuning typically uses following steps:
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 25
Establish acceptable behavior
Measure system performance
Identify critical parts aka
bottlenecks Modify the
system
Measure the performance
after the change
Systematic tuning typically uses following steps:
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 26
Measuring performance
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 27
Establish acceptable behavior
Measure system performance
Identify critical parts aka
bottlenecks Modify the
system
Measure the performance
after the change
Systematic tuning typically uses following steps:
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 28
Know your tools
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 29
Know your OS Establis
h accepta
ble behavior Measure
system perform
ance
Identify critical parts aka
bottlenecks
Modify the
system
Measure the
performance
after the change
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 30
Know you’re app server Establis
h accepta
ble behavior Measure
system perform
ance
Identify critical parts aka
bottlenecks
Modify the
system
Measure the
performance
after the change
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 31
Know your runtime environment Establis
h accepta
ble behavior Measure
system perform
ance
Identify critical parts aka
bottlenecks
Modify the
system
Measure the
performance
after the change
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 32
Unix tools - TOP
DESCRIPTION top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by specifying the feature in the personal or system-wide configuration file.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 33
Unix tools - VMSTAT
DESCRIPTION vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity. The first report produced gives averages since the last reboot. Addi- tional reports give information on a sampling period of length delay. The process and memory reports are instantaneous in either case..
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 34
Unix tools - IOSTAT
Description The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The iostat command generates reports that can be used to change system configuration to better balance the input/output load between physical disks. The first report generated by the iostat command provides statistics concerning the time since the system was booted. Each subsequent report covers the time since the previous report. All statistics are reported each time the iostat command is run. The report consists of a CPU header row followed by a row of CPU statistics. On multiprocessor systems, CPU statistics are calculated system-wide as averages among all processors. A device header row is displayed followed by a line of statistics for each device that is configured. When option -n is used, an NFS header row is displayed followed by a line of statistics for each network filesystem that is mounted.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 35
JDK tools
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 36
JDK tools JINFO
DESCRIPTION jinfo prints Java configuration information for a given Java process or core file or a remote debug server. Configuration information includes Java Systemproperties and Java virtual machine command line flags.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 37
JDK tools JMAP
DESCRIPTION jmap prints shared object memory maps or heap memory details of a given process or core file or remote debug server. NOTE - This utility is unsupported and may or may not be available in future versions of the J2SE SDK. jmap is not currently available on Windows platforms or on the Linux Itanium platform.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 38
JDK tools JSTACK
DESCRIPTION jstack prints Java stack traces of Java threads for a given Java process or core file or a remote debug server. For each Java frame, the full class name, method name, 'bci' (byte code index) and line number, if available, are printed. With the -m option, jstack prints both Java and native frames of all threads along with the 'pc' (program counter). For each native frame, the closest native sym- bol to 'pc', if available, is printed. C++ mangled names are not demangled. To demangle C++ names, the output of this command may be piped to c++filt.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 39
Establish acceptable behavior
Measure system performance
Identify critical parts aka
bottlenecks Modify the
system
Measure the performance
after the change
Systematic tuning typically uses following steps:
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 40
Looking for bottlenecks
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 41
“The "dominating consumer" is a term I coined to help describe a way to identify the fundamental performance problems that an application is facing. Generally, what I find is that no matter how many performance problems are buried in an application, there is one problem that will express itself more prominently than any of the others. Also, performance problems will all express themselves in the hardware, in some manner. So, the purpose of the term "dominating consumer" is to help one identify the underlying nature of the performance problem. My definition for "dominating consumer" is "that activity that is controlling how the CPU is being utilized””.
Kirk Pepperdine http://java.dzone.com/kirk-dominating-consumer
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 42
Demo
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 43
WeakHashMap<K,V>
A hashtable-based Map implementation with weak keys. An entry in a WeakHashMap will automatically be removed when its key is no longer in ordinary use. More precisely, the presence of a mapping for a given key will not prevent the key from being discarded by the garbage collector, that is, made finalizable, finalized, and then reclaimed. When a key has been discarded its entry is effectively removed from the map, so this class behaves somewhat differently from other Map implementations.
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 44
Additional reading
Kirk Pepperdine and his blog http://kirk.blog-city.com/ Attila Szegedi - Everything I Ever Learned about JVM Performance
Tuning @twitter at http://http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter Java Performance book by: Charlie Hunt and
Binu John
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 45
Q&A
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 46
RESTful Java with JAX-RS 2.0 and Jersey
JAX-RS 2.0 (JSR-339) is the next version of a successful Java API for building RESTful web services in Java.
In this presentation i will guide you through the major additions
introduced in the specification that will be brought into Java EE 7 (client API, filters and interceptors, asynchronous processing, data validation, server side content negotiation, hypermedia) and when suitable will show live demos using project Jersey 2.0, the reference implementation of JAX-RS 2.0.
Jakub Podlesak
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 47
We are hiring
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 48
We are hiring
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 49
We are hiring
Managers Tech leads Software Engineers (All levels) QA Automation QA
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 50
Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 51