Java Performance. Adrian Dozsa TM-JUG 18.09.2014

Similar documents
Extreme Performance with Java

The Fundamentals of Tuning OpenJDK

Oracle Corporation Proprietary and Confidential

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

Angelika Langer The Art of Garbage Collection Tuning

Tomcat Tuning. Mark Thomas April 2009

Tuning WebSphere Application Server ND 7.0. Royal Cyber Inc.

Liferay Performance Tuning

Practical Performance Understanding the Performance of Your Application

Java Garbage Collection Basics

JVM Performance Study Comparing Oracle HotSpot and Azul Zing Using Apache Cassandra

JVM Garbage Collector settings investigation

Oracle WebLogic Server 11g: Monitor and Tune Performance

THE BUSY DEVELOPER'S GUIDE TO JVM TROUBLESHOOTING

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

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

ILOG JRules Performance Analysis and Capacity Planning

Introduction to Spark and Garbage Collection

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

Garbage Collection in the Java HotSpot Virtual Machine

Advanced Performance Forensics

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

A Practical Method to Diagnose Memory Leaks in Java Application Alan Yu

Using jvmstat and visualgc to Solve Memory Management Problems

Performance Management for Cloudbased STC 2012

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

XTM Web 2.0 Enterprise Architecture Hardware Implementation Guidelines. A.Zydroń 18 April Page 1 of 12

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

MEASURING WORKLOAD PERFORMANCE IS THE INFRASTRUCTURE A PROBLEM?

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

MONITORING A WEBCENTER CONTENT DEPLOYMENT WITH ENTERPRISE MANAGER

Understanding Java Garbage Collection

Validating Java for Safety-Critical Applications

What s Cool in the SAP JVM (CON3243)

JBoss Seam Performance and Scalability on Dell PowerEdge 1855 Blade Servers

Holistic Performance Analysis of J2EE Applications

Oracle WebLogic Server 11g Administration

Performance Testing of Java Enterprise Systems

Oracle JRockit Mission Control Overview

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

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

How NOT to Measure Latency

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

Java Troubleshooting and Performance

JBoss Data Grid Performance Study Comparing Java HotSpot to Azul Zing

Java Mission Control

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

Zulu by Azul OpenJDK for Azure

An Oracle White Paper July Oracle Primavera Contract Management, Business Intelligence Publisher Edition-Sizing Guide

Performance Analysis of Web based Applications on Single and Multi Core Servers

Top 10 reasons your ecommerce site will fail during peak periods

Java in Virtual Machines on VMware ESX: Best Practices

Advanced Liferay Architecture: Clustering and High Availability

Tool - 1: Health Center

Top 10 Issues for Java in Production. SriSatish Ambati Cliff Click Jr. Azul Systems, Inc

SQL Server Performance Tuning and Optimization

Open Source DBMS CUBRID 2008 & Community Activities. Byung Joo Chung bjchung@cubrid.com

Performance And Scalability In Oracle9i And SQL Server 2000

Low level Java programming With examples from OpenHFT

HP OO 10.X - SiteScope Monitoring Templates

Java Performance Tuning

Transaction Performance Maximizer InterMax

Performance Best Practices Guide for SAP NetWeaver Portal 7.3

Winning the J2EE Performance Game Presented to: JAVA User Group-Minnesota

General Introduction

WEBLOGIC ADMINISTRATION

Enterprise Edition Scalability. ecommerce Framework Built to Scale Reading Time: 10 minutes

JBoss Cookbook: Secret Recipes. David Chia Senior TAM, JBoss May 5 th 2011

Performance Tuning and Optimizing SQL Databases 2016

Microsoft SQL Server: MS Performance Tuning and Optimization Digital

HP NonStop JDBC Type 4 Driver Performance Tuning Guide for Version 1.0

Java Garbage Collection Characteristics and Tuning Guidelines for Apache Hadoop TeraSort Workload

In Memory Accelerator for MongoDB

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

Part 3 - Performance: How to Fine-tune Your ODM Solution. An InformationWeek Webcast Sponsored by

Cognos8 Deployment Best Practices for Performance/Scalability. Barnaby Cole Practice Lead, Technical Services

Efficient Architectures for Low Latency and High Throughput Trading Systems on the JVM

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

SAP BusinessObjects BI4 Sizing What You Need to Know

Production time profiling On-Demand with Java Flight Recorder

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

Apache Tomcat Tuning for Production

Oracle Java SE and Oracle Java Embedded Products

Performance Testing of Big Data Applications

Oracle WebLogic Thread Pool Tuning

Informatica Data Director Performance

Geospatial Server Performance Colin Bertram UK User Group Meeting 23-Sep-2014

Exam : Oracle 1Z : Oracle WebLogic Server 10gSystem Administration. Version : DEMO

Kentico CMS 6.0 Performance Test Report. Kentico CMS 6.0. Performance Test Report February 2012 ANOTHER SUBTITLE

Optimize GlassFish Performance in a Production Environment Performance White Paper February Abstract

<Insert Picture Here> Java Application Diagnostic Expert

Performance Best Practices for Oracle Enterprise Service Bus and Advanced Queueing

BigMemory: Providing competitive advantage through in-memory data management

Transcription:

Java Performance Adrian Dozsa TM-JUG 18.09.2014

Agenda Requirements Performance Testing Micro-benchmarks Concurrency GC Tools

Why is performance important? We hate slow web pages/apps We hate timeouts even more (Black Friday :) You don t want to see a timeout at an ATM More HW cost money A slow site/app is slow business

Trade-offs Performance vs Scalability Latency vs Throughput Availability vs Consistency

Levels Just don t do stupid things Use best practices Consider performance in design Performance drives design Extreme edge cases

Requirements It all starts at the Requirements If we don t know our destination how can we get to it? It should be fast is not a requirement We need hard numbers, and lots of context info We also need HW details Upfront, not at the end NFR requirements can greatly influence your design

Requirements Examples of requirements you might need TPS (avg, 90%, 95%) Latency (avg, 90%, 95%) CPU consumption Memory consumption Data volume (count, size) and distribution Data retention On what HW&middleware

Performance Testing Never guess measure, measure and measure Start with the requirements Define performance use cases And test with real world conditions Beware of Micro-benchmarks

Performance Team anti-pattern Performance starts with Requirements Performance drives design and dev Too late and expensive to address during Performance testing Performance is everyone's responsibility

Micro-benchmarks Do not expect too much from micro-benchmarks Always include a warmup phase Always run with -XX:+PrintCompilation, -verbose:gc Be aware of deoptimization and recompilation effects Reduce noise in your measurements (stable environment) Beware of System.currentTimeMillis (use System. getnano)

JIT Optimizations Method inlining Dead code elimination Loop optimization Control flow optimization Branch prediction Method de-virtualizing

Concurrency Use parallelism (more threads) Avoid sharing data (Share-nothing Architecture) Stateless services Favor immutable data Avoid/minimize synchronization (avoid blocking) Use lock-free algorithms or data structures Avoid/minimize context switching Know your data structures (queue/map implementations)

Garbage Collection Can greatly influence performance (throughput/latency) Understand the basics of GC Understand GC metrics (GC logs) Know the GC algorithms (and their specifics)

Garbage Collection Hotspot Heap Structure

Garbage Collection Reduce GC frequency Reduce GC pause time Heap Size choice - impacts pause time and frequency Object allocation rate and liveliness GC choice based on throughput vs latency new G1 GC option Azul C4 pauseless GC

Garbage Collection Frequency of minor GC is dictated by Application object allocation rate Size of the eden space Frequency of object promotion into old generation is dictated by Frequency of minor GCs (how quickly objects age) Size of the survivor spaces (large enough to age effectively) Object retention impacts latency more than object allocation

Garbage Collection Object allocation is very cheap! Reclamation of new objects is also very cheap! Don t be afraid to allocate short lived objects GCs love small immutable objects and short-lived objects But, don t go overboard It is better to use short-lived immutable objects than longlived mutable objects Ideal situation: After application initialization phase, only experience minor GCs and old generation growth is negligible

Advice on choosing a GC Start with Parallel GC (-XX:+UseParallel[Old]GC) Parallel GC offers the fastest minor GC times If you can avoid full GCs, you ll likely achieve the best throughput, smallest footprint and lowest latency Move to CMS or G1 if needed (for old gen collections) CMS minor GC times are slower due to promotion into free lists CMS full GC avoided via old generation concurrent collection G1 minor GC times are slower due to remembered set overhead G1 full GC avoided via concurrent collection and fragmentation avoided by partial old generation collection

Database I/O is expensive Database calls will be most of the work (do them wisely) N+1 problem (ORM) Caching data Resource Pooling Indexing Minimize round-trips Use query explain plans

Transactions Good for correct programs Not so good for performance and scalability Beware of distributed transactions! ACID is good in short doses (keep transactions short)

Tools Multiple categories Load generation Performance measurement Application monitoring (for production) Profilers (CPU, memory, concurrency) Database tools

Perf4j Perf4J is to System.currentTimeMillis() as log4j is to System.out.println() Simple API Write to log file Parse log file Provides statistics Provides graphs

Apache JMeter Generates load Measures performance Many different server/protocol types Desktop app, pure Java Graphs and reports

Java VisualVM Part of the JDK Powerful tool to troubleshoot, monitor, profile Java apps Provides info on CPU, memory, GC, concurrency, JMX Covers most development needs

YourKit Java Profiler Commercial Java profiler Rich set of features (JEE, IDE integration, SQL, etc) Complex CPU, memory, GC, thread profiling

Java Mission Control Part of JDK (Java 7u40) - former JRockit Mission Control Free for development purposes Tools to monitor, manage, profile Java apps More production oriented (JMV ops) Java Flight Recorder (collect data from app, JVM, OS)

Query plans Learn to read and use query plans - to understand how your query will behave Use SQLDeveloper for Oracle IBM Data Studio for DB2 Microsoft SQL Server Management Studio

References Java Performance book Hotspot JVM GC tuning Java Performance Optimization DZone RefCard Top 10 Most Common Java Performance Problems Performance Testing Java Applications Presentation

Questions?