VisualVM socket.read

So, I have profiled my application using VisualVM.

I hit a hot spot about my interactions with MySQL. My first thoughts were that the hotspot showed the time that my application expected after I / O. But in the profiling report, VisualVM has two columns, "Time" and "Time (processor)." This term may not be used correctly, but I suggested that the self-service column (CPU) excludes I / O time. After more debugging, we came to the conclusion that the assumption was wrong and showed I / O time, since the access point was on java.net.SocketInputStream.read () from the MySQL driver and other I / O objects that should not cost any processor.

So my question is why does visualvm report SocketInputStream.read () as processor time?

Screnshot

+6
source share
3 answers

internal calls are always in the RUNNABLE state when monitoring thread activity, probably due to the fact that the JVM is not able to find out if the native call is sleeping or is doing something. Thus, the elapsed time in the RUNNABLE state is calculated as the processor time.

+4
source

This very long thread claims that small problems can cause problems. It's worth a read, but I don't know what you can do about it. What can you do? You can make sure that you are not using a small sample size . This will not give you small notes, but small readings that lead to the same problem. You can try different platforms for the client or server. This is a mistake that reads:

"We saw a completely different behavior regarding how fast the I / O buffers fill up between Solaris and Linux (and therefore the number of calls to ReadAheadInputStream.fill (), since it reads available, it doesn't block if it needs to read more than available).

+1
source

SocketInputStream.read () blocks until data on the other side is available. Thus, this may be a slow response from your database.

0
source

Source: https://habr.com/ru/post/917242/


All Articles