Are there any libraries available to determine the time a particular call (in this case, it’s is a spring-data/jpa/hibernate call) spends waiting for the network transfer to complete? (That is to say, the time it takes for the bytes to move from the DB to the java app)
Looking at my timing logic, I see hibernate log a query time of 124ms (which aligns with the oracle timing), but then my logs appear to pause for ~10s… before it continues on.
It’s returning about 7000 records, but before I fix that, I would really like to be able to measure that particular piece of the process.
I’m sure I could run wireshark, but I was hoping for something a little more self contained.
1
From a pure Java perspective or self contained within Java, I would suggest looking at using Micrometer. Especially since you are using Spring Boot, observability became a prominent theme/first class citizen in Spring Boot 3/Spring Framework 6.
For Hibernate, there is hibernate-micrometer
module you can pull in as well to automatically instrument Hibernate for you.
However, if you require to go even deeper, you will need to resort to using Aspect Oriented Programming with Spring. You would need to intercept the point in which network call happens and start your timer there.