Do you profile your code using JProfiler or YourKit? You should, because their licenses are worth every penny when you can find a very hidden and subtle bottleneck deep down in your application.
For instance, the following chart shows nicely that there was a significant performance issue in jOOQ related to reflection:
I’ll spare you the details about the fix, but the
RecordMapper.map() method is where the magic happens. The
DefaultRecordMapperProvider.provide() method is really just boring initialisation. No way should it gobble up 96% of the benchmark. So the fix was applied and we profile again:
As you can see, the
RecordMapper.map() is now using up most of the CPU time (the whole thing accelerated from 134 seconds down to 1.4 seconds in a benchmark)
Now, profilers cost some money and if money for the license is an issue for you, then there is good news! Since JDK 7u40, Oracle now ships their Oracle Java Mission Control (JMC) for its Hotspot VM and you can use it for free in development environments (not in production). But that’s more than enough!
JMC isn’t quite as powerful yet as JProfiler or YourKit. But again, you’re doing this because you want to save money, and that’s better than just staring at the JMX console or throwing random thread dumps around your console.
For more information, visit the following website: