Java Performance: The Definitive Guide

Java Performance: The Definitive Guide
Другая компьютерная литература, Программы
Год: 2014
Добавил: Admin 1 Авг 20
Проверил: Admin 1 Авг 20
Формат:  PDF (13005 Kb)
  • Currently 0/5

Рейтинг: 0/5 (Всего голосов: 0)

Аннотация

When O’Reilly first approached me about writing a book on Java performance tuning, I was unsure. Java performance, I thought—aren’t we done with that? Yes, I still work on performance of Java (and other) applications on a daily basis, but I like to think that I spend most of my time dealing with algorithmic inefficiences and external system bottlenecks rather than on anything directly related to Java tuning.
A moment’s reflection convinced me that I was (as usual) kidding myself. It is certainly true that end-to-end system performance takes up a lot of my time, and that I sometimes come across code that uses an O(n 2) algorithm when it could use one with O(log N) performance. Still, it turns out that every day, I think about GC performance, or the performance of the JVM compiler, or how to get the best performance from Java En‐ terprise Edition APIs.
That is not to minimize the enormous progress that has been made in the performance of Java and JVMs over the past 15-plus years. When I was a Java evangelist at Sun during the late 1990s, the only real “benchmark” available was CaffeineMark 2.0 from Pendra‐ gon software. For a variety of reasons, the design of that benchmark quickly limited its value; yet in its day, we were fond of telling everyone that Java 1.1.8 performance was eight times faster than Java 1.0 performance based on that benchmark. And that was true—Java 1.1.8 had an actual just-in-time compiler, where Java 1.0 was pretty much completely interpreted.
Then standards committees began to develop more rigorous benchmarks, and Java performance began to be centered around them. The result was a continuous improve‐ ment in all areas of the JVM—garbage collection, compilations, and within the APIs.
That process continues today, of course, but one of the interesting facts about perfor‐ mance work is that it gets successively harder. Achieving an eightfold increase in per‐ formance by introducing a just-in-time compiler was a straightforward matter of en‐ gineering, and even though the compiler continues to improve, we’re not going to see an improvement like that again. Paralellizing the garbage collector was a huge perfor‐ mance improvement, but more recent changes have been more incremental.
This is a typical process for applications (and the JVM itself is just another application):
in the beginning of a project, it’s easy enough to find archictural changes (or code bugs) which, when addressed, yield huge performance improvements. In a mature application, finding such performance improvements is quite rare.
That precept was behind my original concern that, to a large extent, the engineering world might be done with Java performance. A few things convinced me I was wrong.
First is the number of questions I see daily about how this or that aspect of the JVM performs under certain circumstances. New engineers come to Java all the time, and JVM behavior remains complex enough in certain areas that a guide to how it operates is still beneficial. Second is that environmental changes in computing seem to have altered the performance concerns that engineers face today.
What’s changed in the past few years is that performance concerns have become bifur‐ cated. On the one hand, very large machines capabable of running JVMs with very large heaps are now commonplace. The JVM has moved to address those concerns with a new garbage collector (G1), which—as a new technology—requires a little more hand-tuning than traditional collectors. At the same time, cloud computing has renewed the importance of small, single-CPU machines: you can go to Oracle or Amazon or a host of other companies and very cheaply rent a single CPU machine to run a small appli‐ cation server. (You’re not actually getting a single-CPU machine: you’re getting a virtual OS image on a very large machine, but the virtual OS is limited to using a single CPU.
From the perspective of Java, that turns out to be the same as single-CPU machine.) In those environments, correctly managing small amounts of memory turns out to be quite important.
The Java platform also continues to evolve. Each new edition of Java provides new language features and new APIs that improve the productivity of developers—if not always the performance of their applications. Best practice use of these language features can help to differentiate between an application that sizzles, and one that plods along.
And the evolution of the platform brings up interesting performance questions: there is no question that using JSON to exchange information between two programs is much simpler than coming up with a highly optimized proprietary protocol. Saving time for developers is a big win—but making sure that productivity win comes with a perfor‐ mance win (or at least breaks even) is the real goal.

Похожие книги

Комментарии к книге "Java Performance: The Definitive Guide"

Комментарий не найдено. Будьте первыми!
Чтобы оставить комментарий или поставить оценку книге Вам нужно зайти на сайт или зарегистрироваться