In the previous part of this series, we learned how JVM works behind the hoods, what is JIT Compilation and what is and how to track Code Cache and now we will see how to tune the Code Cache!
Increasing the Code Cache Size
When we have a code compiled to tier 4, eventually this code will be added at Code Cache. The problem is because this Code Cache has a limit size, so, in case that we have a huge amount of methods compiled to tier 4, some code eventually will be removed from the Code Cache to make space for the next code, and in the future, this removed code could be added again removing another code block. …
Following the thinking line based on the second part of this series, I’ll explain better what means deoptimization.
Deoptimization means that the compiler needs to “undo” a previous compilation. The effect is that the performance of the application will be reduced (at least until the compiler can recompile the code).
So to clarify, when the JVM executes code, it does not begin compiling the code immediately, and here are two basic reasons for this.
First one: Let’s imagine that we have a code that will be executed only one time, then compiling it is a completely wasted effort. …
Hello again, people!
If you read the first part of this series and is wondering:
How can I check if that specific code was compiled to a native machine language?
You are in the correct place! Now I’ll explain we can check and analyze the JIT Compilation logs. So, let’s go!
There is a JVM flag that can help us with this investigation, and this flag is “-XX:+PrintCompilation”.
Here is an example of the output:
50 1 3 java.lang.StringLatin1::hashCode (42 bytes)53 2 3 java.lang.Object::<init> (1 bytes)53 3 3 java.lang.String::isLatin1 (19 bytes)54 4 3 java.util.concurrent.ConcurrentHashMap::tabAt (22 bytes)
60 5 3 java.lang.String::charAt (25 bytes)
60 6 3 java.lang.StringLatin1::charAt (28 bytes)
60 7 3 java.lang.String::coder (15 bytes)
88 40 n 0 java.lang.invoke.MethodHandle::linkToSpecial(LLLLLLLL)L (native) (static)
88 39 ! 3 java.util.concurrent.ConcurrentHashMap::putVal (432 bytes)
90 41 n 0 java.lang.System::arraycopy (native) (static)
91 42 3 java.lang.String::length (11 bytes)
129 3 3 java.lang.String::isLatin1 (19 bytes) made not entrant
138 150 n 0 java.lang.Object::getClass …
I can see that the Java community is growing a lot but there are a lot of Java developers only focused on Spring, microservices, and other fancy tools, and forgetting to understand how the incredible Java Virtual Machine works.
I can understand that, using Spring Boot in a microservices architecture, will be rare the case where we need to tune the performance of an application (since we have a microservice / micro-application and Spring Boot brings to us the Development by Convention) based on a JVM investigation.
But I’m the type of person that really wants to know how things work behind the hood, and I think this knowledge is important to create better and performative code. …
One more article about the Java 8 features! Oh yeah!
Now we’ll talk about Two-Argument (Bi) Functional Interfaces and Primitive Type Functional Interfaces and understand what the benefits are when working with Primitive Types combined with Functional Interfaces.
If you did not read the second part, I strongly suggest you read it before start here!
Ok, now we already saw all the predefined functional interfaces, and I’m sure that you realized something really interesting.
The number of input parameter?
You are simply AMAZING!
Yes, you are right! Function, Predicate, and Supplier can only receive 1 input parameter, and in some cases, we need another one, how can we handle this case? …
I was looking forward to posting this second part because here we have important features of Java 8 that are not so famous!
So, I’ll not prolong too much, let’s understand Functional Interfaces!!!
I’ll start with a really simple explanation!
Functional Interface is an interface that only has one abstract method!
Hmm, but what is an abstract method?
An abstract method is a method that doesn’t have a body, which means that this method only has a signature!
Following the Java releases, today I’ll explain the most important changes that we have in Java 8!
Note: If you did not see the article about Java 7, click here!
Java 8 was released officially on March 18, 2014, as you can see here!
For me, this is the most important major release in the history of Java and you will see why!
So, Java 8 had a huge amount of improvements and new features, but I’ll focus on the enhancements that IMHO impacted the daily work of all Java Developers. You can check the complete list here.
As I said, we had a lot of interesting things in Java 8, so, I’ll split this article into 5 parts. Below are the topics that we’ll explore in the different parts. …
Hey, I’m here again!
The time is passing so fast and when we decided to look to it we figure out that Java is already in version 13!
So, if you are familiar with one of the phrases below, this series is for you!
“Oh my God, I’m working with Java 6, what did I miss?”
“Yes, I know, I’m working with Java 8, but I only changed because I would like to use Lambda”
“Yes, I know, I’m working with Java 10, but only because is easy to migrate from 8 to 10”
“Yes, I know, I’m working with Java 13, but to be honest, I don’t know what changed, I only like to keep…
This is the second part of the series where I’m trying to show my vision, as a Software Engineer about DDD.
In the first part, I did an introduction about some ideas around DDD and I wrote about the Strategic topic. Now I’ll talk about the Tactical topic.
Here we go!
One of the most important things here is to know that DDD does not require you to follow ANY specific TECHNOLOGY. DDD’s efforts are focused on domain definition and not on telling you that Spring Boot is better than Quarkus or RabbitMQ is better than Kafka.
Knowing this we can focus on what matters in this first tactical step, the definition of architecture. …
Hey people, how are you?
I have recently read a lot of DDD articles and realized that many people (especially devs) are still quite confused about what DDD really is, its strengths, its weaknesses. Perhaps this is due to the huge variety of views on DDD that we find out there and the fact that DDD uses some terms that are part of a developer’s daily life that have totally different meanings.
The first thing to keep in mind is: No, DDD won’t save your life, and in some cases, it will only make it worse (at the beginning) so that you have to rewrite all of your code after a while. …