For More information, refer to Java EE 7 performance tuning and optimization book: The book is published by Packt Publishing: http://www.packtpub.com/java-ee-7-performance-tuning-and-optimization/book
Java Colombo Meetup on 22nd March 2018 Speaker: Isuru Perera, Technical Lead at WSO2 Flame graphs are a visualization of profiled software and it was developed by Brendan Gregg, an industry expert in computing performance and cloud computing. Finding out why CPUs are busy is an important task when troubleshooting performance issues and we often use a sampling profiler to see which code-paths are hot. However, a profiler will dump a lot of data with thousands of lines and it is not easy to go through all data. With Flame Graphs, we can identify the most frequent code-paths quickly and accurately. Basically, a Flame Graph can simply visualize the stack traces output of a sampling profiler. There are many ways to profile Java applications and Java Flight Recorder (JFR) is a really good tool to profile a Java application with a very low overhead. I will show how we can generate a Flame Graph from a Java Flight Recording using the JFR Flame Graph tool (https://github.com/chrishantha/jfr-flame-graph) I developed. Since Flame Graphs can visualize any stack profiles, we can also use a Linux system profiler (perf) and create a Java Mixed-Mode Flame Graph, which will show how much CPU time is spent in Java methods, system libraries and the kernel. We can troubleshoot performance issues related to high CPU usage easily with a flame graph showing profile information from both system code paths and Java code paths. I will discuss how we can use the -XX:+PreserveFramePointer option in JDK and the perf system profiler to generate a Java Mixed-mode flame graph.
This document summarizes changes to the Java programming language from JDK 9 to JDK 16, including new features and modules. Some key points: - Java has moved to a six-month release cycle, delivering more features faster than before. - Modules were introduced in JDK 9 to improve modularity. Modules group related code and dependencies. - Incubator modules and preview features allow testing of non-final APIs before inclusion in the Java SE platform. - Local variable type inference using 'var' was added in JDK 10 for simpler declaration of local variables when types can be inferred. - Modules, the module system, and tools like jlink and jdeps help manage dependencies
The Java Virtual Machine (JVM) is an abstract computing machine that executes Java bytecode. It has several core components including a class loader, memory areas like the heap and stack, and an execution engine. The execution engine initially interprets bytecode instructions but can optimize performance by just-in-time compiling frequently used bytecode into native machine code. The JVM provides a layer of abstraction between Java applications and the underlying hardware or operating system.
This document discusses different approaches for profiling Java applications without using third-party tools. It begins by explaining the benefits of a do-it-yourself approach such as avoiding reliability and compliance concerns with tools. Various profiling types are then covered, including CPU profiling using wall clock time and calls, sampling, and memory profiling using JVM options. Bytecode manipulation is also presented as a method using ASM to add profiling code without changing sources. The document emphasizes learning the Java Virtual Machine and using its built-in capabilities for profiling purposes.
The document discusses Java memory allocation profiling using the Aprof tool. It explains that Aprof works by instrumenting bytecode to inject calls that count and track object allocations. This allows it to provide insights on where memory is being allocated and identify potential performance bottlenecks related to garbage collection.
Guest lecture at University of Colombo School of Computing on 27th May 2017 Covers following topics: Software Profiling Measuring Performance Java Garbage Collection Sampling vs Instrumentation Java Profilers. Java Flight Recorder Java Just-in-Time (JIT) compilation Flame Graphs Linux Profiling
The Java Memory Model defines rules for how threads interact through shared memory in Java. It specifies rules for atomicity, ordering, and visibility of memory operations. The JMM provides guarantees for code safety while allowing compiler optimizations. It defines a happens-before ordering of instructions. The ordering rules and visibility rules ensure threads see updates from other threads as expected. The JMM implementation inserts memory barriers as needed to maintain the rules on different hardware platforms.
This document discusses concurrency in Java. It covers benefits and risks of threads, goals of concurrency utilities in Java, examples of executor services and thread pools, and best practices for thread safety including using immutable objects, atomic variables, and concurrent collections.
Here you will learn - What is Multithreading What is concurrency Process Vs Thread Improvements and issues with concurrency Limits of concurrency gains Concurrency issues Threads pools with the Executor Framework AsyncTask and the UI Thread Code
This document discusses various programming paradigms and concurrency concepts in Java. It covers single and multi-process programming, multi-threading, processes, threads, synchronization, deadlocks, and strategies for designing objects to be thread-safe such as immutability, locking, and containment. It also summarizes high-level concurrency utilities in Java like locks, executors, concurrent collections, and atomic variables.
Every Java developer knows that multithreading is the root of all evil and it is quite hard to write correct code for concurrent environment. But what tasks do exist in real commercial development except running code in asynchronous way? In this talk I will present several tasks from my real projects and solutions we designed for them. This talk is very application oriented and allows participants to extend their vision of concurrent programming.
The document discusses various techniques for testing large, distributed systems beyond traditional unit testing. It recommends embracing virtualization to simulate production environments and deploying applications and tests across multiple virtual machines. Various tools are presented to help with distributed, automated testing including Cactus for in-container testing, Selenium and jsUnit for browser testing, and SmartFrog as a framework for describing, deploying and managing distributed service components and tests. The document calls for a focus on system-level tests that simulate the full production environment and integrate testing across distributed systems.
Slides from tech talk about the art of non-blocking waiting in Java with LockSupport.park/unpark and AbstractQueuedSynchronizer. Presented on JPoint 2016 Conference.
Guest lecture at Informatics Institute of Technology (IIT) on 24th November 2018 Covers following topics: Concurrency Processes and Threads Concurrent vs Parallel Programming Preemptive multitasking Context Switches Java Threads Thread Dumps Java Troubleshooting, Profiling, Monitoring and Management Tools Synchronization Thread Interference Memory Consistency Errors Synchronized Methods Intrinsic Locks and Synchronization Atomic Access Liveness Deadlock Starvation Livelock Flame Graphs
Presentation given at the Rennes (FR) Java User Group in Feb 2019. How do we go from your Java code to the CPU assembly that actually runs it? Using high level constructs has made us forget what happens behind the scenes, which is however key to write efficient code. Starting from a few lines of Java, we explore the different layers that constribute to running your code: JRE, byte code, structure of the OpenJDK virtual machine, HotSpot, intrinsic methds, benchmarking. An introductory presentation to these low-level concerns, based on the practical use case of optimizing 6 lines of code, so that hopefully you to want to explore further!
This document provides an overview of common tools used for building, logging, and unit testing Java applications: Maven for build automation, Log4J2 and SLF4J for logging, and JUnit for unit testing. It describes the purpose and basic usage of each tool. For Maven, it covers the standard project layout, dependencies, lifecycle, and POM file. For logging, it explains Log4J2 configuration and best practices. And for testing, it introduces the JUnit framework and common assertions.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
This document summarizes a hands-on performance workshop. It introduces the speaker and explains that the workshop will focus on hands-on experience using performance tools. The agenda outlines setting up the environment, an overview of performance factors, collecting performance data using tools like GC logs and thread dumps, and interpreting that data using tools like VisualVM. It notes some topics that won't be covered and provides instructions for optional extension activities.
This document summarizes tools and techniques for Java profiling and diagnostics. It discusses using JMX, JVMTI, and the Attach API to gather information on threading, memory usage, garbage collection, and perform actions like heap dumps. It also introduces the SJK toolkit which provides commands for profiling tasks and the Sigar and BTrace tools. Real-world uses of profiling techniques are presented, like benchmarking and diagnosing production systems. Future ideas proposed include a visual thread analyzer and scripting-based heap dump exploration.
This document discusses various tools for diagnosing and monitoring applications running on the Java Virtual Machine (JVM). It begins with an overview of demo tools like jps, jcmd, jstat, and Java Mission Control. It then discusses internals of how these tools access a running JVM through mechanisms like JMX, attaching to processes, and the jvmstat performance data file. The document concludes with a discussion of future improvements including more diagnostic commands, JMX enhancements, improved JVM logging, and removing older tools.
This document discusses tools and techniques for troubleshooting Java applications. It begins with an introduction to the speaker, Chris Bailey, and his background in Java monitoring and diagnostics. It then covers various approaches for monitoring memory usage at both the operating system and Java runtime levels, including tools for capturing garbage collection data and heap dumps. Finally, it discusses performance analysis and profiling CPU and lock usage at the application level.
This is a talk I did for JavaOne 2009. The focus of the talk was memory management and system monitoring with freely available tools that are in the jdk or open source.
The main body of work related to supporting dynamic languages on the JVM at Oracle today is done within the Nashorn project. While on the surface it looks like we're busy creating a JavaScript runtime, in reality JavaScript is only the beginning, and not the ultimate goal. Nashorn has served as the proving ground for new approaches for implementing a dynamic language on top of the JVM, and we're eager to – once solidified – crystallize these into a reusable dynamic language implementer's toolkit. We have faced challenges of optimally mapping JavaScript local variables to JVM types (or: "hey, there's a static type inference algorithm in your dynamic language compiler"), doing liveness analysis, cutting up methods too large to fit into a single JVM method, efficiently representing large array and object literals in compiled code, creating a system for on-demand compilation of several type-specialized variants of the same function, and more. Along the way, we have reached the limits of our initial internal representation (fun fact: you can't do liveness analysis on an AST. We learned it the hard way.) and started sketching up an intermediate representation that would be easy to emit from a dynamic language compiler, and that could be taken over by a toolchain to perform the operations described above then on it and finally output standard Java bytecode for JIT to take over. Elevator pitch: like LLVM, but for dynamic languages on the JVM.
The document discusses garbage collection in the Java HotSpot virtual machine. It covers the basics of garbage collection theory, HotSpot's memory organization and different collectors. The presentation also discusses how to read and analyze GC logs to understand application performance and identify issues like memory leaks or premature promotion.
This presentation discusses strategies to estimate and control the memory use of multi-threaded java applications. It includes a quick overview of how the JVM uses memory, followed by techniques to estimate the memory usage of various types of objects during testing. This knowledge is then used as the basis for a runtime scheme to estimate and control the memory use of multiple threads. The final part of the presentation describes how to implement robust handling for unchecked exceptions, especially Out Of Memory (OOM) errors, and how to ensure threads stop properly when unexpected events occur.
The document discusses HTML5 game development. It covers various topics like game concepts, HTML5 components for games, developing a game step-by-step and advanced topics. It focuses on HTML5 canvas for graphics, local storage for data, and describes functions for animations, interactions, controls and other elements needed for game development. The document provides examples for drawing, colors, images and text on the canvas.
The document discusses several case studies of performance issues with Java EE applications and provides solutions. It emphasizes the importance of understanding the entire system, including infrastructure components, and using tools like monitoring, thread dumps, and logging to observe problems before hypothesizing and testing solutions. The first case study found a server with debug logging enabled slowing it down. The second was due to firewalls terminating idle database connections. The third involved inefficient AJAX and an underpowered load tester.
For More information, refer to Java EE 7 performance tuning and optimization book: The book is published by Packt Publishing: http://www.packtpub.com/java-ee-7-performance-tuning-and-optimization/book
Große Entwicklungsabteilungen stehen oft vor dem Problem einheitlicher Entwicklungsprozesse und Werkzeuge. Nach einiger Zeit hat jedes Projekt eigene Prozesse und Werkzeuge etabliert. Dies ist nicht im Sinne der Entwicklungsabteilung. Softwaresysteme müssen i. d. R. über Jahre hinweg gewartet und erweitert werden - oft von einem Team, das sich neu in die Anwendung einarbeiten muss. Nicht selten stellt die Rekonstruktion der Entwicklungsumgebung einen erheblichen Aufwand dar. Dieser Vortrag beschreibt - anhand eines Erfahrungsberichts - den Aufbau einer strukturierten Entwicklungsumgebung, die auch für grosse Entwicklungsabteilungen skaliert. - Zentrale Projekt- und Codeverwaltung (ähnlich wie Sourceforge) - Buildmanagement mit Maven - Entwicklungswerkzeuge basierend auf Maven und Eclipse - Installierbare Teamserver mit Virtualisierungstechnologie für Continuous Integration
Summarizes about a year worth of experiences and case studies in performance tuning the JVM for various services at Twitter.
How to identify memory leaks in java applications, thread contentions, using jdk in built tools to identify performance bottlenecks
This document provides an overview of threading concepts in .NET, including: 1) Threads allow concurrent execution within a process and each thread has its own call stack. The CLR uses thread pools to improve efficiency of asynchronous operations. 2) Thread synchronization is required when threads access shared resources to prevent race conditions and deadlocks. The .NET framework provides classes like Monitor, Lock, and Interlocked for thread synchronization. 3) Limiting threads improves performance on single-CPU systems due to reduced context switching overhead.
An opinionated position on JVM performance tuning with practical application. Includes expertise from Jason Goth
The document discusses several topics related to optimizing Java program performance including: 1. Using buffering and non-blocking I/O for file reading/writing to improve efficiency. 2. Minimizing network calls by retrieving related data in one call and using design patterns like the session facade. 3. Reusing objects when possible rather than constantly creating new instances to reduce garbage collection overhead.
In this presentation, I show the improvements made on the CrawlerLD tool to make it distributable and have a better performance.
This presentation discusses strategies to estimate and control the memory use of multi-threaded java applications. It includes a quick overview of how the JVM uses memory, followed by techniques to estimate the memory usage of various types of objects during testing. This knowledge is then used as the basis for a runtime scheme to estimate and control the memory use of multiple threads. The final part of the presentation describes how to implement robust handling for unchecked exceptions, especially Out Of Memory (OOM) errors, and how to ensure threads stop properly when unexpected events occur.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Multitasking allows multiple tasks to share system resources like the CPU by rapidly switching between tasks. In iOS, multithreading uses either Cocoa threads via the NSThread class or POSIX threads. Threads offer advantages like lower overhead than processes but also challenges like added complexity. Common threading techniques include atomic operations, locks, conditions, and Grand Central Dispatch which handles scheduling tasks across threads.
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
Nowadays we have 2 options for concurrency in Java: * simple, synchronous, blocking code with limited scalability that tracks well linearly at runtime, or. * complex, asynchronous libraries with high scalability that are harder to handle. Project Loom aims to bring together the best aspects of these two approaches and make them available to developers. In the talk, I'll briefly cover the history and challenges of concurrency in Java before we dive into Loom's approaches and do some behind-the-scenes implementation. To manage so many threads reasonably needs some structure - for this there are proposals for "Structured Concurrency" which we will also look at. Some examples and comparisons to test Loom will round up the talk. Project Loom is included in Java 19 and 20 as a preview feature, it can already be tested how well it works with our applications and libraries. Spoiler: Pretty good.
This document provides an overview of multithreading in Java. It describes how multithreading allows an application to perform multiple tasks simultaneously through the use of threads. It explains that threads allow applications to remain responsive even when long tasks are being performed. The document outlines how threads work in Java, including how to create threads using the Thread and Runnable classes, the different states threads can be in, and common concurrency issues that can arise with multithreading like race conditions.
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
This document discusses Java multithreading. It explains that multithreading allows an application to have multiple points of execution within the same memory space. It outlines how Java supports multithreading through the Thread class and Runnable interface. It also describes concurrency issues that can arise from multithreading, such as race conditions, and how to address them using techniques like synchronized access and locking.
This document discusses Java multithreading. It begins by outlining the objectives of understanding multithreading, Java's mechanism, concurrency issues, and synchronized access. It then explains that multithreading allows multiple threads to run simultaneously within a process's memory space. Finally, it covers key topics like creating and running threads, thread states, priorities, and ensuring thread-safe access to shared resources through synchronization.
This document discusses multithreading in Java. It begins by explaining that multithreading allows multiple tasks to be performed concurrently by having each task executed in a separate thread. It then covers key topics like how threads are implemented in Java using the Thread class and Runnable interface, how to create and manage threads, common thread states, ensuring thread safety through synchronization, and techniques to improve synchronization performance.