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

Similar documents
How to analyse your system to optimise performance and throughput in IIBv9

These sub-systems are all highly dependent on each other. Any one of them with high utilization can easily cause problems in the other.

Tomcat Tuning. Mark Thomas April 2009

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

J2EE-JAVA SYSTEM MONITORING (Wily introscope)

Effective Java Programming. measurement as the basis

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

OS Thread Monitoring for DB2 Server

Java Troubleshooting and Performance

Liferay Performance Tuning

Multi-core Programming System Overview

BridgeWays Management Pack for VMware ESX

ELEC 377. Operating Systems. Week 1 Class 3

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

Java Performance Tuning

Using jvmstat and visualgc to Solve Memory Management Problems

Zing Vision. Answering your toughest production Java performance questions

WebSphere Architect (Performance and Monitoring) 2011 IBM Corporation

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

Extreme Linux Performance Monitoring Part II

Chapter 3 Operating-System Structures

Delivering Quality in Software Performance and Scalability Testing

Understand Performance Monitoring

opensm2 Enterprise Performance Monitoring December 2010 Copyright 2010 Fujitsu Technology Solutions

Audit & Tune Deliverables

Application of Predictive Analytics for Better Alignment of Business and IT

Oracle WebLogic Thread Pool Tuning

Why Computers Are Getting Slower (and what we can do about it) Rik van Riel Sr. Software Engineer, Red Hat

CSE 403. Performance Profiling Marty Stepp

Practical Performance Understanding the Performance of Your Application

Chapter 2 System Structures

White Paper Perceived Performance Tuning a system for what really matters

Performance monitoring. in the GNU/Linux environment. Linux is like a wigwam - no Windows, no Gates, Apache inside!

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Agenda. Enterprise Application Performance Factors. Current form of Enterprise Applications. Factors to Application Performance.

HPC performance applications on Virtual Clusters

Apache Tomcat Tuning for Production

Garbage Collection in the Java HotSpot Virtual Machine

Effective Java Programming. efficient software development

MCTS Guide to Microsoft Windows 7. Chapter 10 Performance Tuning

Windows Server Performance Monitoring

Advanced Performance Forensics

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

Mission-Critical Java. An Oracle White Paper Updated October 2008

CA Nimsoft Monitor. Probe Guide for Active Directory Server. ad_server v1.4 series

PEPPERDATA IN MULTI-TENANT ENVIRONMENTS

TDA - Thread Dump Analyzer

Help! My system is slow!

W4118 Operating Systems. Instructor: Junfeng Yang

Performance Management in the Virtual Data Center, Part II Memory Management

Kernel Optimizations for KVM. Rik van Riel Senior Software Engineer, Red Hat June

Agility Database Scalability Testing

Computer-System Architecture

Adaptive Server Enterprise

Resource Aware Scheduler for Storm. Software Design Document. Date: 09/18/2015

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

Disk Storage Shortfall

Tech Tip: Understanding Server Memory Counters

Operating Systems. Lecture 03. February 11, 2013

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Architecture Support for Big Data Analytics

An Implementation Of Multiprocessor Linux

Enterprise Manager Performance Tips

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

CS423 Spring 2015 MP4: Dynamic Load Balancer Due April 27 th at 9:00 am 2015

Distributed Systems. Virtualization. Paul Krzyzanowski

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

Release February 2005

CIT 470: Advanced Network and System Administration. Topics. Performance Monitoring. Performance Monitoring

Performance Testing. Configuration Parameters for Performance Testing

Java Performance. Adrian Dozsa TM-JUG

Best Practices for Monitoring Databases on VMware. Dean Richards Senior DBA, Confio Software

Performance Analysis of Android Platform

Web Performance, Inc. Testing Services Sample Performance Analysis

WebSphere Performance Monitoring & Tuning For Webtop Version 5.3 on WebSphere 5.1.x

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Java VM monitoring and the Health Center API. William Smith

Java in Virtual Machines on VMware ESX: Best Practices

Real-time KVM from the ground up

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

SYSTEM ecos Embedded Configurable Operating System

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

Facultat d'informàtica de Barcelona Univ. Politècnica de Catalunya. Administració de Sistemes Operatius. System monitoring

Linux scheduler history. We will be talking about the O(1) scheduler

THE BUSY DEVELOPER'S GUIDE TO JVM TROUBLESHOOTING

Monitoring HP OO 10. Overview. Available Tools. HP OO Community Guides

Java Virtual Machine: the key for accurated memory prefetching

MagDiSoft Web Solutions Office No. 102, Bramha Majestic, NIBM Road Kondhwa, Pune Tel: /

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

Performance rule violations usually result in increased CPU or I/O, time to fix the mistake, and ultimately, a cost to the business unit.

Transcription:

Příprava studijního programu Informatika je podporována projektem financovaným z Evropského sociálního fondu a rozpočtu hlavního města Prahy. Praha & EU: Investujeme do vaší budoucnosti Enterprise Java (BI-EJA) Technologie programování v jazyku Java (X36TJV) Katedra softwarového inženýrství Fakulta informačních technologií ČVUT v Praze Letní semestr 2010/2011, přednáška č. 12 Zdeněk Troníček, 2011

Performance Performance improvements Premature optimization Coding in Java Hardware monitoring Performance patterns 2

Introduction Our goal is to improve user experience Java performance tuning is more an art than a science Do not optimize prematurely Correctness is always over performance Kirk Pepperdine: Measure, don t guess 3

User Experience User experience is subjective Focus on improving the user experience User experience can be improved by optimization tuning other means (e.g. a progress bar) 4

Performance Tips Do not trust them Do not use them unless they are justified by measurement Beware of premature optimization 5

Premature Optimization D. E. Knuth (1974): We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. M. A. Jackson (1975): We follow two rules in the matter of optimizations: Rule 1. Don't do it. Rule 2 (for experts only). Don't do it yet - that is, not until you have a perfectly clear and unoptimized solution. Why is premature optimization bad? It seldom has any effect on performance It usually worsens readability 6

Premature Optimization (cont.) Let s assume that findmax is O( m ) for ( int i : values ) { if ( i > findmax ( anothervalues ) ) { } } O( m * n ) vs. O( m + n ) int max = findmax ( anothervalues ); for ( int i : values ) { if ( i > max ) { } } 7

Premature Optimization (cont.) for ( int i = 0, n = p.size(); i < n; i++ ) { } vs. for ( int i = 0; i < p.size(); i++ ) { } This is okay if size() is O( 1 ) 8

How to Code in Java? Focus on architecture Use efficient technologies and frameworks Use sound design principles and patterns Use efficient algorithms Prefer readable and understandable code Brian Goetz: Write dumb code 9

How to Improve Performance? Performance problem can be in Hardware JVM configuration Application code 10

Hardware Monitoring Tools Utilization of CPU Task Manager vmstat User space Kernel space Utilization of memory Physical memory 11

Hardware Monitoring (cont.) Utilization of network Utilization of disk 12

vmstat procs procs memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id 0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82 0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62 0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64 0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78 r = runnable threads in run queue b = blocked threads w = runnable but swapped 13

vmstat memory procs memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id 0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82 0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62 0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64 0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78 swap = swap space available (in kilobytes) free = memory available (in kilobytes) 14

vmstat page procs memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id 0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82 0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62 0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64 0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78 pi = kilobytes paged in po = kilobytes paged out 15

vmstat disk procs memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id 0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82 0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62 0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64 0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78 number of disk operations per second 16

vmstat faults procs memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id 0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82 0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62 0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64 0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78 in = device interrupts sy = system calls cs = context switches 17

vmstat cpu procs memory page disk faults cpu r b w swap free re mf pi po fr de sr s0 s1 s2 s3 in sy cs us sy id 0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 130 4 14 82 0 0 1 10132 4280 0 4 44 0 0 0 0 0 23 0 0 211 230 144 3 35 62 0 0 1 10132 4616 0 0 20 0 0 0 0 0 19 0 0 150 172 146 3 33 64 0 0 1 10132 5292 0 0 9 0 0 0 0 0 21 0 0 165 105 130 1 21 78 us = user time sy = system time id = idle time 18

Performance Bounds Performance can be bound by CPU Memory I/O (disk or network) Locks These bounds manifest themselves in different ways 19

Performance Patterns 20 Manifestation CPU utilization in user space CPU utilization in kernel space Idle CPU Possible cause Application or JVM Bad interaction with operating system Locks Locks Small thread pool Small connection pool Slow I/O

CPU Utilization in User Space Utilization of CPU User space Kernel space Observation CPU utilization is near 100% and mostly in user space Next step Monitor garbage collector 21

GC Monitoring (Visual VM) Observation Next step GC activity is < 5% of CPU Profile CPU GC activity is > 10% of CPU Tune GC 22

CPU Utilization in Kernel Space Utilization of CPU User space Kernel space Observation CPU utilization in kernel space is more than 10% or more than ½ of total time Next step Profile CPU 23

Idle CPU Utilization of CPU Observation CPU is not fully utilized Next step Monitor threads 24

CPU Profiling (Visual VM) Methods with largest time are candidates for optimization 25

Thread Monitoring (Visual VM) 26

Demo: Monitoring Classify given programs into four categories: CPU utilized by application CPU utilized by garbage collector CPU utilized by operating system Idle CPU 27

Otázky & odpovědi tronicek@fit.cvut.cz