Today I’d like to speak a bit regarding #Java Flight Recorder (JFR) and how far you can get with it. #OpenJDK#JFR#JMC
So, as you may know, a few releases ago, Java developers were able to create, publish, and react to particular JDK events, also known as JFR.
The first and most important JFR feature is that the whole JDK is pierced with tons of JFR events. You can enable them to get most of the information about what’s going on with the JVM.
Another valuable feature is the ability to create custom events of different nature. The JDK JFR framework does not enforce developers regarding the type and the nature of events, so, most events are free-form classes that extend "jdk.jfr.Event" class.
Recently, I decided to explore how complicated it is to implement a resource state-tracking event. Meaning, that a certain entity will emit events based on some state of an object through its lifecycle.
In my case the idea was to track how many actively running threads are in the thread pool provided in the form of an executor to the HTTP server whose purpose is to run long-running math operations like FIPS-140-3 tests against certain bite-sequences:
The biggest challenge is that ExecutorService doesn’t provide API methods to know how many threads are up and running at a particular moment. So, to bypass the problem, we’d have to wrap an executor accompanied by an atomic counter:
In order to make the most negligible impact against executor service and the code running in threads, the easiest trick is to enhance the executor with a service thread that will process the value of an atomic counter and build stats out of it:
By enabling this event in the recording stream, we can observe how often the amount of actively running threads is changing through the lifecycle of an executor service:
And later on, those events can be observed in Java Mission Control:
Another massive topic with the JFR is: is it really a good idea to turn a subscriber-based operation model (you can only react to the particular event) into a poll-based model...
... i.e., build an interface between JFR and server metrics that can be consumed more straightforwardly than JMX socket-based interface just on purpose for JFR event streaming.
If it’s possible and really makes a lot of sense then it will significantly simplify application metrics emitting and consuming within 3rd-party metering services over HTTP in a cloud (VMs, K8s, etc).
• • •
Missing some Tweet in this thread? You can try to
force a refresh
You know that JDK 19 will be released in 2 months on Sept. 20th. It will bring some major changes to the JDK. Project #Loom is one of those HUGE changes I want to talk about a little bit more. #Java#OpenJDK
JEP 425 introduces Virtual Threads. The most interesting thing is that the JDK was reworked to make it possible to block both platform and virtual threads in different ways.
While thread blocking methods will put on pause the whole platform thread, the virtual thread blocking wouldn't block its underlying carrier thread so it can pick up the segment of another virtual thread to execute.
This is the first war in a modern world where we have more than just one physical frontier. As Ukrainian IT community we started another one - virtual. I’ll explain you how it works here in #Ukraine and abroad
[thread]:
#Ukraine has more than 160K IT specialists: hardware engineers, cloud engineers, software engineers, devops, architects, QA, etc.
We do have IT security folks known as Ukrainian Cyber Alliance (@UCA_ruhate_). They were the first ones who attacked #Russia’s IT infrastructure.
Yesterday I explained you how a war in Ukraine will affect Europe in terms of food.
Today I will explain you how it will affect your comfort [thread]:
I’d you didn’t know - Ukraine average per hour rate is pretty low comparing to European. That’s why we do lots of outsourcing businesses. We have thousands of smart engineers who do work for US/EU businesses.
VM, Mercedes-Daimler, BMW uses Ukraine as an R&D centers.
The reason why I love and hate #Kubernetes is it actually good platform to host scalable apps. But the road from developing the app to making it scalable is so painful. Here are few-reasons-why-thread:
#Kubernetes in its bare configuration can only host containers and let you talk to them. Include config maps, volumes, RBAC, etc.
If you ever wanted to scale your app on #Kubernetes you probably heard of MetricsServer - it can collect standard metrics like CPU and RAM of every pod/container.
It’s not a part of #k8s distribution - you need to install it separately.