JVM JIT diagnostic tools and optimization tips

匆匆过客 提交于 2019-12-03 14:12:48

If you want a brain dump, you can print the resulting assembly code, but this is much lower level than what you have already. I suspect what you are looking for doesn't exist for the HotSpot JVM. I saw a presentation for something like this based on JRockit and perhaps this will make it into HotSpot one day.

Am I missing something obvious here? What do JVM performance-aware programmers do when optimizing tight inner loops to figure out what is going on?

Usually, I like to minimise garbage production and this usually performs well enough. e.g for micro-seconds latencies.

This sort of micro-optimisation really requires a deep understand of machine code and how CPUs really work.

Surely the low-level -XX flags can't be the only option, can they?

If only it where that simple, it is far more complicated. To dump the machine code you need an additional native library which doesn't ship with the JVM. ;)

I'd appreciate hints on how best to deal with this sort of low-level stuff on the JVM.

It appears you don't really want to work at the low level if you can avoid it and I believe this is a good thing, you have to take care of the high level first because micro-optimisation is good for micro-benchmarks but rarely good for real applications because you need to understand all the latencies of your end to end system and this you can do without even looking at the code in many cases. i.e. is the main delay in your database, OS, disk, or network IO.

I'm still curious if people have general tips and tools for this kind of activity.

Use a profiler, and if you suspect you need to go lower, it is quite likely you have missed something far more important.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!