O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Java: High-Performance Apps with Java 9

Book Description

Optimize the powerful techniques of Java 9 to boost your application's performance

About This Book

  • Tackle all kinds of performance-related issues and streamline your development
  • Dive into the new features of Java 9
  • Implement highly efficient and reliable codes with the help of new APIs of Java
  • Embedded with assessments that will help you revise the concepts you have learned in this book

Who This Book Is For

This book is targeted at developers who would like to build reliable and high-performance applications with Java.

What You Will Learn

  • Familiarize with modular development and its impact on performance
  • Learn various string-related performance improvements, including compact string and modify string concatenation
  • Explore various underlying compiler improvements, such as tiered attribution and Ahead-of-Time (AOT) compilation
  • Learn security manager improvements
  • Understand enhancements in graphics rasterizers
  • Use of command-line tools to speed up application development
  • Learn how to implement multithreading and reactive programming
  • Build microservices in Java 9
  • Implement APIs to improve application code

In Detail

Java 9 which is one of the most popular application development languages. The latest released version Java 9 comes with a host of new features and new APIs with lots of ready to use components to build efficient and scalable applications. Streams, parallel and asynchronous processing, multithreading, JSON support, reactive programming, and microservices comprise the hallmark of modern programming and are now fully integrated into the JDK.

This book focuses on providing quick, practical solutions to enhance your application's performance. You will explore the new features, APIs, and various tools added in Java 9 that help to speed up the development process. You will learn about jshell, Ahead-of-Time (AOT) compilation, and the basic threads related topics including sizing and synchronization. You will also explore various strategies for building microservices including container-less, self-contained, and in-container.

This book is ideal for developers who would like to build reliable and high-performance applications with Java.

This book is embedded with useful assessments that will help you revise the concepts you have learned in this book.

Style and approach

This book is a fast-paced guide that provides practical solutions to enhance your application's performance.

Note: This book is a blend of text and quizzes, all packaged up keeping your journey in mind. It includes content from the following Packt product:

  • Java 9 High Performance by Mayur Ramgir and Nick Samoylov

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Java: High-Performance Apps with Java 9
    1. Java: High-Performance Apps with Java 9
    2. Credits
      1. Meet Your Experts
    3. Preface
      1. What's in It for Me?
      2. What Will I Get from This Book?
      3. Prerequisites
    4. 1. Learning Java 9 Underlying Performance Improvements
      1. Introducing the New Features of Java 9
      2. Modular Development and Its Impact
        1. Quick Introduction to Modules
      3. String Operations Performance
        1. Compact String
          1. The World of Heap
        2. Why Bother Compressing Strings?
          1. What Did They Do?
          2. What is the Escape Route?
          3. What is the Performance Gain?
        3. Indify String Concatenation
          1. Invokedynamic
      4. Storing Interned Strings in CDS Archives
      5. Concurrency Performance
      6. Compiler Improvements
        1. Tiered Attribution
        2. Ahead-of-Time Compilation
      7. Security Manager Improvements
      8. Graphics Rasterizers
      9. Summary
      10. Assessments
    5. 2. Tools for Higher Productivity and Faster Application
      1. The JShell Tool Usage
        1. Creating a JShell Session and Setting Context
        2. JShell Commands
      2. Ahead-of-Time (AOT)
        1. Static versus Dynamic Compilation
        2. The AOT Commands and Procedures
      3. Summary
      4. Assessments
    6. 3. Multithreading and Reactive Programming
      1. Prerequisites
      2. Thread Pools
      3. Monitoring Threads
      4. Sizing Thread Pool Executors
      5. Thread Synchronization
      6. Tuning JVM
      7. Reactive Programming
      8. Summary
      9. Assessments
    7. 4. Microservices
      1. Why Microservices?
      2. Building Microservices
      3. Container-Less Deployment
      4. Self-Contained Microservices
      5. In-Container Deployment
      6. Summary
      7. Assessments
    8. 5. Making Use of New APIs to Improve Your Code
      1. Filtering Streams
        1. Basic Filtering
          1. Using Other Stream Operations for Filtering
      2. Stack-Walking APIs
        1. Stack Analysis before Java 9
        2. New Better Way to Walk the Stack
      3. Convenience Factory Methods for Collections
        1. Why New Factory Methods?
        2. The New Factory Methods in Action
      4. CompletableFuture in Support of Asynchronous Processing
        1. The CompletableFuture API Overview
        2. The CompletableFuture API Enhancements in Java 9
        3. The Problem and the Solution using Future
        4. The Solution with CompletableFuture
        5. Other Useful Features of CompletableFuture
      5. Stream API Improvements
      6. Summary
      7. Assessments
    9. A. Assessment Answers
      1. Lesson 1: Learning Java 9 Underlying Performance Improvements
      2. Lesson 2: Tools for Higher Productivity and Faster Application
      3. Lesson 3: Multithreading and Reactive Programming
      4. Lesson 4: Microservices
      5. Lesson 5: Making Use of New APIs to Improve Your Code