What is Java ThreadSanitizer and Heap Monitoring?

Video overview of useful Java tools from Google developers
07 August 2017   1895

Java

Popular general-purpose programming language and computing platform

Code health is important for Google, and team have many tools to help Google's Java developers write correct and performant code. The following presentation presents two such tools: Java ThreadSanitizer and Heap Profiling. Java ThreadSanitizer is used during testing, and helps to find data races. Heap Profiling is used in production, and is concerned with efficient monitoring of heap usage. Both dive into the depths of the JVM, with many interesting technical challenges.

ThreadSanitizer (TSAN) is a well-known dynamic data race detection tool based on LLVM. . For many years, Google's Java developers had no tool to detect data races.  There is a strong desire to see data races across the Java/JNI boundary to facilitate debugging. Hence, team have added enough instrumentation in the JVM and the JDK to allow the TSAN runtime to understand Java synchronization and see Java fields.

Some of challenges encountered:

  • adapting to TSAN's fixed-offset instrumentation when Java objects get moved,
  • the need to track *all* sources of user-visible synchronization in the JVM (including j.u.concurrent),
  • the need to annotate JDK classes for correct-by-JMM races,
  • correct forwarding of signal handling,
  • symbolization of race reports.

Despite this, there has been a steady stream of adoption by internal teams over the years. Another aspect of Google tooling is understanding the memory footprint and how to effectively reduce it. One constraint is having the mechanism on by default and, as a
consequence, the system must have a low overhead. The solution is the second tool called Heap Profiling. The solution provides users with statistical information about where the Java program is allocating its memory by providing stacktraces. It tracks via the Garbage Collection's passes what objects have been collected to offer insight on objects that are heavily churning and those that are remaining in the heap. This information allows users to understand what allocation hotspots exist, which are causes for heap growth, and what objects are often Garbage Collected. To push the feature forward, a JEP was created (JDK-8171119) and work has gone at a steady pace to provide heap allocation understanding with a low overhead. The following presentation will showcase the system, what tools were built on top of the data, how it is used in Google, and why it is important for Java engineers.

In conclusion, both tools presented provide insight on the JVM: Java ThreadSanitizer helps understand thread concurrency and Heap Monitoring provides insight the memory allocation.

Tiobe February 2019 Index Released

Groove language is in top 20 again; it's popularity increased due to Gradle; Java is 1st
11 February 2019   334

In February, search engine statistics showed that the dynamically typed Groovy language is gaining popularity again. As analysts of TIOBE noted, it was already in the top twenty of the TIOBE index in 2016 on the wave of interest in the Jenkins system for continuous integration. Now it is pushed forward by the Gradle assembly automation system.

TIOBE Februry 2019 Index
TIOBE Februry 2019 Index

More analysts noticed that the language Hack this month entered the top 50, and TypeScript left it (in their opinion, temporarily). Since February last year, Python and C ++ swapped places, and again topped the list with Java and C.