• Complain

Chris Newland - Optimizing Java

Here you can read online Chris Newland - Optimizing Java full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: O’Reilly Media, Inc., genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Chris Newland Optimizing Java

Optimizing Java: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Optimizing Java" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Performance tuning is an experimental science, but that doesnt mean engineers should resort to guesswork and folklore to get the job done. Yet thats often the case. With this practical book, intermediate to advanced Java technologists working with complex technology stacks will learn how to tune Java applications for performance using a quantitative, verifiable approach.

Most resources on performance tend to discuss the theory and internals of Java virtual machines, but this book focuses on the practicalities of performance tuning by examining a wide range of aspects. There are no simple recipes, tips and tricks, or algorithms to learn. Performance tuning is a process of defining and determining desired outcomes. And it requires diligence.

  • Learn how Java principles and technology make the best use of modern hardware and operating systems
  • Explore several performance tests and common anti-patterns that can vex your team
  • Understand the pitfalls of measuring Java performance numbers and the drawbacks of microbenchmarking
  • Dive into JVM garbage collection logging, monitoring, tuning, and tools
  • Explore JIT compilation and Java language performance techniques
  • Learn performance aspects of the Java Collections API and get an overview of Java concurrency

Chris Newland: author's other books


Who wrote Optimizing Java? Find out the surname, the name of the author of the book and a list of all author's works by series.

Optimizing Java — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Optimizing Java" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Chapter 1. Optimization and Performance Defined

Optimizing the performance of Java (or any other sort of code) is often seen as a Dark Art.Theres a mystique about performance analysisits commonly viewed as a craft practiced by the lone hacker, who is tortured and deep thinking (one of Hollywoods favorite tropes about computers and the people who operate them).The image is one of a single individual who can see deeply into a system and come up with a magic solution that makes the system work faster.

This image is often coupled with the unfortunate (but all-too-common) situation where performance is a second-class concern of the software teams.This sets up a scenario where analysis is only done once the system is already in trouble, and so needs a performance hero to save it.The reality, however, is a little different.

The truth is that performance analysis is a weird blend of hard empiricism and squishy human psychology.What matters is, at one and the same time, the absolute numbers of observable metrics and how the end users and stakeholders feel about them.The resolution of this apparent paradox is the subject of the rest of this book.

Java PerformanceThe Wrong Way

For many years, one of the top three hits on Google for Java performance tuning was an article from 19978, which had been ingested into the index very early in Googles history.The page had presumably stayed close to the top because its initial ranking served to actively drive traffic to it, creating a feedback loop.

The page housed advice that was completely out of date, no longer true, and in many cases detrimental to applications.However, its favored position in the search engine results caused many, many developers to be exposed to terrible advice.

For example, very early versions of Java had terrible method dispatch performance.As a workaround, some Java developers advocated avoiding writing small methods and instead writing monolithic methods.Of course, over time, the performance of virtual dispatch greatly improved. Not only that, but with modern Java Virtual Machines (JVMs) and especially automatic managed inlining, virtual dispatch has now been eliminated at the majority of call sites.Code that followed the lump everything into one method advice is now at a substantial disadvantage, as it is very unfriendly to modern Just-in-Time (JIT) compilers.

Theres no way of knowing how much damage was done to the performance of applications that were subjected to the bad advice, but this case neatly demonstrates the dangers of not using a quantitative and verifiable approach to performance. It also provides another excellent example of why you shouldnt believe everything you readon the internet.

Note

The execution speed of Java code is highly dynamic and fundamentally depends on the underlying Java Virtual Machine. An old piece of Java code may well execute faster on a more recent JVM, even without recompiling the Java source code.

As you might imagine, for this reason (and others we will discuss later) this book is not a cookbook of performance tips to apply to your code. Instead, we focus on a range of aspects that come together to produce good performance engineering:

  • Performance methodology within the overall software lifecycle

  • Theory of testing as applied to performance

  • Measurement, statistics, and tooling

  • Analysis skills (both systems and data)

  • Underlying technology and mechanisms

Later in the book, we will introduce some heuristics and code-level techniques for optimization, but these all come with caveats and tradeoffs that the developer should be aware of before using them.

Tip

Please do not skip ahead to those sections and start applying the techniques detailed without properly understanding the context in which the advice is given.All of these techniques are capable of doing more harm than good if you lack a proper understanding of how they should be applied.

In general, there are:

  • No magic go faster switches for the JVM

  • No tips and tricks to make Java run faster

  • No secret algorithms that have been hidden from you

As we explore our subject, we will discuss these misconceptions in more detail, along with some other common mistakes that developers often make when approaching Java performance analysis and related issues. Still here? Good. Then lets talk about performance.

Java Performance Overview

To understand why Java performance is the way that it is, lets start by considering a classic quote from James Gosling, the creator of Java:

Java is a blue collar language. Its not PhD thesis material but a language for a job.

That is, Java has always been an extremely practical language. Its attitude to performance was initially that as long as the environment was fast enough, then raw performance could be sacrificed if developer productivity benefited. It was therefore not until relatively recently, with the increasing maturity and sophistication of JVMs such as HotSpot, that the Java environment became suitable for high-performance computing applications.

This practicality manifests itself in many ways in the Java platform, but one of the most obvious is the used of managed subsystems. The idea is that the developer gives up some aspects of low-level control in exchange for not having to worry about some of the details of the capability under management.

The most obvious example of this is, of course, memory management. The JVM provides automatic memory management in the form of a pluggable garbage collection subsystem, so that memory does not have to be manually tracked by the programmer.

Note

Managed subsystems occur throughout the JVM and their existence introduces extra complexity into the runtime behavior of JVM applications.

As we will discuss in the next section, the complex runtime behavior of JVM applications requires us to treat our applications as experiments under test.This leads us to think about the statistics of observed measurements, and here we make an unfortunate discovery.

The observed performance measurements of JVM applications are very often not normally distributed.This means that elementary statistical techniques (e.g., standard deviation and variance) are ill-suited for handling results from JVM applications.This is because many basic statistics methods contain an implicit assumption about the normality of results distributions.

One way to understand this is that for JVM applications outliers can be very significantfor a low-latency trading application, for example.This means that sampling of measurements is also problematic, as it can easily miss the exact events that have the most importance.

Finally, a word of caution.It is very easy to be misled by Java performance measurements.The complexity of the environment means that it is very hard to isolate individual aspects of the system.

Measurement also has an overhead, and frequent sampling (or recording every result) can have an observable impact on the performance numbers being recorded.The nature of Java performance numbers requires a certain amount of statistical sophistication, and naive techniques frequently produce incorrect results when applied to Java/JVM applications.

Performance as an Experimental Science

Java/JVM software stacks are, like most modern software systems, very complex.In fact, due to the highly optimizing and adaptive nature of the JVM, production systems built on top of the JVM can have some incredibly subtle and intricate performance behavior.This complexity has been made possible by Moores Law and the unprecedented growth in hardware capability that it represents.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Optimizing Java»

Look at similar books to Optimizing Java. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Optimizing Java»

Discussion, reviews of the book Optimizing Java and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.