Effective Java Programming. measurement as the basis



Similar documents
Java Troubleshooting and Performance

THE BUSY DEVELOPER'S GUIDE TO JVM TROUBLESHOOTING

Effective Java Programming. efficient software development

Java Debugging Ľuboš Koščo

An Oracle White Paper September Advanced Java Diagnostics and Monitoring Without Performance Overhead

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

Holly Cummins IBM Hursley Labs. Java performance not so scary after all

TDA - Thread Dump Analyzer

CSE 403. Performance Profiling Marty Stepp

How To Use Java On An Ipa (Jspa) With A Microsoft Powerbook (Jempa) With An Ipad And A Microos 2.5 (Microos)

Practical Performance Understanding the Performance of Your Application

Monitoring and Managing a JVM

Monitoring and Diagnosing Production Applications Using Oracle Application Diagnostics for Java. An Oracle White Paper December 2007

Tools in the Box. Quick overview on helpful tools in the JDK and use cases for them. Florin Bunau

Trace-Based and Sample-Based Profiling in Rational Application Developer

Performance Monitoring and Tuning. Liferay Chicago User Group (LCHIUG) James Lefeu 29AUG2013

Java VM monitoring and the Health Center API. William Smith

Java Mission Control

Performance Testing and Optimization in Web-Service Based Applications

How To Improve Performance On An Asa 9.4 Web Application Server (For Advanced Users)

WebSphere Architect (Performance and Monitoring) 2011 IBM Corporation

Tool - 1: Health Center

Advanced Performance Forensics

11.1 inspectit inspectit

HeapStats: Your Dependable Helper for Java Applications, from Development to Operation

Monitoring applications in multitier environment. Uroš Majcen A New View on Application Management.

Debugging Java performance problems. Ryan Matteson

Using jvmstat and visualgc to Solve Memory Management Problems

What s Cool in the SAP JVM (CON3243)

Windows Server Performance Monitoring

Tomcat Tuning. Mark Thomas April 2009

NetBeans Profiler is an

Oracle JRockit Mission Control Overview

Eclipse Visualization and Performance Monitoring

B M C S O F T W A R E, I N C. BASIC BEST PRACTICES. Ross Cochran Principal SW Consultant

Essentials of Java Performance Tuning. Dr Heinz Kabutz Kirk Pepperdine Sun Java Champions

Monitoring Java enviroment / applications

Instrumentation Software Profiling

PTC System Monitor Solution Training

Cisco Unified Contact Center Express and Cisco Unified IP IVR - Best Practices

1 How to Monitor Performance

<Insert Picture Here> Java Application Diagnostic Expert

Java Monitoring. Stuff You Can Get For Free (And Stuff You Can t) Paul Jasek Sales Engineer

Oracle WebLogic Thread Pool Tuning

Transaction Performance Maximizer InterMax

Performance Testing. Based on slides created by Marty Stepp

Oracle Corporation Proprietary and Confidential

IBM Software Group. SW5706 JVM Tools IBM Corporation 4.0. This presentation will act as an introduction to JVM tools.

Agility Database Scalability Testing

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Java DB Performance. Olav Sandstå Sun Microsystems, Trondheim, Norway Submission ID: 860

Tutorial: Load Testing with CLIF

BEAJRockit Mission Control. Using JRockit Mission Control in the Eclipse IDE

Apache Tomcat Tuning for Production

1 How to Monitor Performance

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET)

Response Time Analysis

Delivering Quality in Software Performance and Scalability Testing

Understanding Server Configuration Parameters and Their Effect on Server Statistics

Why Threads Are A Bad Idea (for most purposes)

Operating Systems and Networks

Load Testing and Monitoring Web Applications in a Windows Environment

Identifying Performance Bottleneck using JRockit. - Shivaram Thirunavukkarasu Performance Engineer Wipro Technologies

Load Testing with JMeter

Zing Vision. Answering your toughest production Java performance questions

Performance Testing of Java Enterprise Systems

THE BUSY JAVA DEVELOPER'S GUIDE TO WEBSPHERE DEBUGGING & TROUBLESHOOTING

Configuring Apache Derby for Performance and Durability Olav Sandstå

talent. technology. true business value

Performance Improvement In Java Application

Enterprise Manager Performance Tips

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

Top 10 reasons your ecommerce site will fail during peak periods

2015 ej-technologies GmbH. All rights reserved. JProfiler Manual

Informatica Master Data Management Multi Domain Hub API: Performance and Scalability Diagnostics Checklist

A Scalability Study for WebSphere Application Server and DB2 Universal Database

Configuring Apache Derby for Performance and Durability Olav Sandstå

Profiling and Testing with Test and Performance Tools Platform (TPTP)

External Sorting. Why Sort? 2-Way Sort: Requires 3 Buffers. Chapter 13

Restraining Execution Environments

Troubleshoot the JVM like never before. JVM Troubleshooting Guide. Pierre-Hugues Charbonneau Ilias Tsagklis

Enterprise Java (BI-EJA) Technologie programování v jazyku Java (X36TJV)

Performance White Paper

The Hotspot Java Virtual Machine: Memory and Architecture

SOA Solutions & Middleware Testing: White Paper

Chapter 3 Operating-System Structures

Response Time Analysis

Performance Tuning Guide for ECM 2.0

Tuning Your GlassFish Performance Tips. Deep Singh Enterprise Java Performance Team Sun Microsystems, Inc.

Each of the advisory has a health level indicating severity of the issue found, pattern, name, keyword and related advice.

Course Description. Course Audience. Course Outline. Course Page - Page 1 of 5

Transcription:

Effective Java Programming measurement as the basis

Structure measurement as the basis benchmarking micro macro profiling why you should do this? profiling tools

Motto "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." Donald Knuth

The problem Modern software is too complex Even the wisest man is not suitable for performance tuning need for techniques and tools! benchmarking profiling

What is benchmarking? it is a comparison of different solutions on the basis of measurements (time, memory,...) different solutions, but giving the same results different data structures different technologies (ORM, MVC) various containers the essence is to compare single result does not say anything results are useful when you can compare them

How to measure? stopwatch funny, but often appropriate the most versatile technique no interference with the code does not require complicated tools you do not always need the milliseconds application start time time to open a document time scrolling through large tables DB query execution time

How to measure? measurements taken into account in the code calculation based on system time before and after run System.currentTimeMillis () precision in milliseconds (?) interference with the code - can lead to failure addition to each method is tedious generic stopwatch class

Why build benchmarks? ready made ones to compare the JRE but they do not evaluate your program you need to create a benchmark studying your code comparison of alternative solutions performance profiling in your application track performance and trends in the manufacturing cycle benchmark - code, environment, utility allows for comparison of different solutions repeatable test cases

Micro-benchmark checks for a specific part of the system often even a few lines of code, for example: Draw a rectangle 100 000, read 10MB file from disk Sorting an array of 100 000 elements, performance of specific tasks good quick execution, focus on the problem bad - does not represent the behavior of a real application JVM "warm up" unrealistic interactions in the system

Macro-benchmark "true" macro benchmark tests the system in the form the user sees it I would have to have the system ready... how to simulate? work on real data run on the target platform lean on use cases you need to understand how users will work with the system interactions and the correct sequence of events

Benchmark analysis results often vary considerably between executions background processes network traffic GC perform many times and average the results compare results of different solutions min, max, average

What is profiling? profiling is to identify components consuming the most resources RAM CPU network identify system bottlenecks there are special tools allows to determine the most inefficient parts of the system

Why profile? you know which parts of the system have the greatest impact on performance you know what changes will bring the greatest benefits you avoid common mistakes premature optimization optimization of the bad parts of the system too thorough optimization

Flat profiles problem usually to specify bottlenecks for the first time is quite simple after eliminating more difficult to see others common mistake is to rely solely on the time spent in the method it is also important: how often the method is called how much time is spent calling other methods

Flat profiles problem Method Time [ms] Method Total time [ms] Time [ms] m1 5 m2 2 m3 1 m4 1 m1 30 1 m2 24 2 m3 10 5 m4 3 1

Flat profiles problem Having only the execution time you often mistakenly refer to bottlenecks what to do? speed up frequently used methods less invokes of slow methods real life example - JTable in Swing first optimization - leafs Swing 1.1-2 times faster lack of clear bottlenecks JViewport problem when scrolling problem was in JTable update redesigned - 3 times faster

What do the tools give? typically allow you to find: what methods are most often called most time consuming methods which methods call most commonly used methods methods consuming most memory commercial tools have powerful GUI different views sophisticated statistics

Problems Too less memory - 3 kinds of memory: heap for arrays and objects error message: Java heap space when: during class instantiation non-heap stack for addresses, variables, class definitions and strings error message: PermGen space when: eg. loading class native managed by OS, used by native methods error message: request <size> bytes for <reason>. Out of swap space? when: using native libraries

Problems memory leaks GC does not clean up objects that have incidental references pointing to them can lead to memeory leak GC can work more often finalization potential memory leak object overriding finalize will not be removed before calling this method it is uncertain when or whether the method will be called in the end similar to memory leaks deadlock synchronization is faulty 2 or more threads are simultaneously waiting for monitor release

Problems looped threads thread has infinite loop uses more and more CPU time can crash whole application too many locks synchronization blocks threads frequent waiting for monitor can starve thread application is too slow identify bottlenecks which methods cause most load?

Tools jhat - Java Heap Analysis Tool analyses heap dump preview in browser has its own query language OQL jconsole - Java Monitoring and Management Console GUI for monitoring and managing Java applications and JVM works locally and remotely shows memory, threads, classes, pending finalizations

Tools jstat - JVM Statistical Monitoring Tool shows performance statistics not supported - can be removed in future versions jmap - Memory Map shows details about the stack not supported jstack - Stack Trace shows call stack for threads useful when looking for deadlocks not supported java -Xhprof - Heap/CPU profiling tool since early versions of Java heap and CPU usage by methods

Tools Java Visual Virtual Machine bin\jvisualvm.exe since Java 6 update 7 much better than jconsole GUI track many JVM at once remote JVM tracking profiling options

Profiling on Eclipse basic tools are often "raw" commercial - expensive there are free plugins for Eclipse that provide profilers with a convenient GUI TPTP profiles Eclipse plugins local Java applications complex applications running on multiple machines and different platforms

Conclusions what is benchmarking? what is a benchmark? how differs macro from micro benchmark? what is profiling? what are the problems with flat profiles?