三津石智巳

👦🏻👦🏻👧🏻 Father of 3 | 🗺️ Service Reliability Engineering Manager at Rakuten Travel | 📚 Avid Reader | 👍 Wagashi | 👍 Caffe Latte | 👍 Owarai

【感想】Java Performance, 2nd Edition


あっという間に第2版が出たな。

"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 architectural changes (or code bugs) that, when addressed, yield huge performance improvements. In a mature application, finding such performance improvements is rare."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/preface01.html

日常的に見るな…

"In those environments, correctly managing small amounts of memory turns out to be quite important."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/preface01.html

これは知りたいな。

"This book is designed for performance engineers and developers who are looking to understand how various aspects of the JVM and the Java APIs impact performance."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/preface01.html

パフォーマンスエンジニアっていう職務作りたいよなー。

"This chapter discusses four principles of getting results from performance testing: test real applications; understand throughput, batching, and response time; understand variability; and test early and often."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch02.html

4つの原則。

"The second principle is to understand and select the appropriate test metric for the application. Performance can be measured as throughput (RPS), elapsed time (batch time), or response time, and these three metrics are interrelated."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch02.html

3種のメトリクス。

"It will take some time for a server to reach peak performance; to the users accessing the application during that time, the performance during the warm-up period does matter."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch02.html

ユーザーにとってはウォームアップであろうと満足度に影響する。

"The common way to present these results is to say that there is a 57% confidence level that there is a 25% improvement in the results. Though that isn’t exactly the same thing and will drive statisticians crazy, it is easy shorthand to adopt and isn’t that far off the mark."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch02.html

こういう補足説明助かる。

"Performance engineers aren’t going to attempt to make JVM methods faster, but they can figure out how to speed up object serialization in general."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch03.html

なんか面白い。

"The older (though still useful) approach to visualizing the performance is a top-down approach known as the call tree. Figure 3-4 shows an example."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch03.html

call treeは古いのか…

いずれにせよGitHub - jvm-profiling-tools/async-profiler: Sampling CPU and HEAP profiler for Java featuring AsyncGetCallTrace + perf_eventsは試す価値ありそう。

"Native profilers provide visibility into both the JVM code and the application code."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch03.html

native profiler使ったことない。

"Command-line monitoring tools can gather important data automatically; be sure to include gathering this monitoring data in your automated performance testing."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch03.html

これな。

"retrieving a value from main memory is an expensive operation that takes multiple cycles to complete"

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

いい価値観。

"On the other hand, the number of threads can easily overwhelm the system, particularly if multiple JVMs are run at once (each of which will start many compilation threads). Reducing the number of threads in that case can help overall throughput (though again with the possible cost that the warm-up period will last longer)."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

なるほど。CPUコア数でデフォルト値が決まる場合Multiple JVMs環境で気をつけなければならないのか。

"That is exactly what the compiler does for Intel chips. In 2011, Intel introduced Advanced Vector Extensions (AVX2) for the Sandy Bridge (and later) chips. JVM support for those instructions soon followed. Then in 2016 Intel extended this to include AVX-512 instructions; those are present on Knights Landing and subsequent chips. Those instructions are not supported in JDK 8 but are supported in JDK 11."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

CPU分からんなー。

"you may be running in a Docker container with a small memory limit or in a cloud virtual machine that just doesn’t have quite enough memory. Or you may be running dozens of JVMs on your large machine. In those cases, you may want to reduce the memory footprint of your application."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

メモリ節約考える場面もあるな。

"in general, you never need to recompile to bytecodes in order to take advantage of new features."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

知らなかった。

"Don’t be afraid of small methods—and, in particular, getters and setters—because they are easily inlined. If you have a feeling that the method overhead can be expensive, you’re correct in theory (we showed that removing inlining significantly degrades performance). But it’s not the case in practice, since the compiler fixes that problem."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

小さいメソッドは恐れなくて良い。

"The simpler the code, the more optimizations that can be performed on it. Profile feedback and escape analysis can yield much faster code, but complex loop structures and large methods limit their effectiveness."

 

via Check out this quote from Java Performance, 2nd Edition - https://learning.oreilly.com/library/view/java-performance-2nd/9781492056102/ch04.html

シンプルなことは人にもコンパイラにも良い。