#5 Java Flight Recorder Event Streaming
Multithreading in Java: synchronization and concurrency. The Deadlock Empire: Slay dragons, master concurrency. Collections Corner Cases. Humble Book Bundle
Welcome to the fifth Duckesletter edition
Today’s newsletter is dedicated to Carl Quinn, Rest In Peace.
Day by day, and thanks to healthcare workers we are gaining to the Covid-19. Thanks for staying at home!
The fourth edition was delivered to 410 persons and reached 780 views.
1.- Java Flight Recorder Event Streaming
JDK 14 was launched two weeks ago, but we have still more things to talk about!
One of the most interesting features released in the latest version is JFR Event Streaming, which will open a great set of opportunities in the world of JVM real-time monitoring.
You can read the specification from: “JEP 349: JFR Event Streaming”.
The feature doesn’t add metrics or new monitoring capabilities to the already impressive functionalities, it just adds the ability to produce a continuous stream of events.
Thanks to a new API you can handle events in real-time, rather than by parsing a file after finishing the profiling session.
Application Performance Monitoring
Imagine having real-time access to all the metrics provided by JFR on your production servers. APM tools have now a standardized way to get performance metrics and integrate them into their platforms.
One such platform is New Relic, and in anticipation of the functionality, they have announced support in its product.
Ben Evans, Principal Engineer at New Relic, has written a post in Oracle’s blog introducing JFR Event Streaming: “Java Flight Recorder and JFR Event Streaming in Java 14“ and did an interview at InfoQ talking about their support: “New Relic Introduces Real-Time Java Profiling“
Custom Events
One of the key features of Java Flight Recorder is that it allows you to create custom JFR events and integrate it into the generated profile file, and now in the new Event Streaming. You are not limited to existing metrics and you can add any kind of information to it.
In “Monitoring REST APIs with Custom JDK Flight Recorder Events”, Gunnar Morling explains how to add information about REST endpoints to JFR and visualize it with Java Mission Control.
In “Deep Distributed Tracing with OpenTracing and the JDK Flight Recorder“, Marcus Hirt explains how to integrate OpenTracing with JFR.
I expect that thanks to this feature a new set of tools or integrations (open source or proprietary) will emerge. These will improve our capability of fixing bugs and performance problems in production environments.
2.- Multithreading in Java. Synchronization and concurrency
The number of cores in our servers is increasing each year, and as developers we must learn how to use them correctly.
The simplest way to take advantage of available resources with multiple cores is using the multithreading capabilities that Java provides.
In “Multithreading in Java. Java synchronization and concurrency. The most important information for a Java Developer interview”, Michał Fabjański makes an introduction to Java Threads and different concepts related to it. It's a good article to get started in the world of concurrency issues.
3.- The Deadlock Empire. Slay dragons, master concurrency!
If the above article doesn't give you enough insight, I propose you to play to the next game: Deadlock Empire.
The game proposes challenges around concurrency problems. Each problem is a program that executes two or more threads and your objective as Scheduler is to exploit flaws in the programs to make them crash or otherwise malfunction.
Programs syntax is C#, and uses some C# classes for synchronization directives, but it is understandable if you don’t know C#.
Which level can you reach?
4.- Collections Corner Cases
Java Collections Framework is a basic piece of the Java ecosystem and it is important to know how it works.
Stuart Marks explains in the following talk in latest Devoxx:
This session isn't a typical survey of the Collections interfaces and implementation classes. Instead, it's a deep exploration of some of the corners of the Collections Framework that will reveal some little-known features. These features can be useful and powerful, but their behavior can also be startling, leading to unexpected bugs for the unwary.
5.- Humble Book Bundle: Software Development
Last week Humble Bundle, in collaboration with O’Reilly, published a very interesting Book Bundle.
I didn't have any of the books, but the references I've gotten from some of them is good and makes it worth buying.