Profile network java (jdbc)

3

What tool can I use to evaluate the response time of a request (jdbc)

Ex:

query = "SELECT * FROM v$version WHERE banner LIKE '%Oracle%'";
ResultSet rs = stmt.executeQuery(query);
// linha de cima ⋀ 
// quanto tempo demorou nesse meio ?
// linha de baixo ⋁
rs.next();

No log appears

15:58:35.175 INFO - 6. SELECT * FROM v$version WHERE banner LIKE '%Oracle%'; {executed in 1 ms}

In fact the query was executed with 1ms but there is a gap between executing the query and loading this information.

What tool can I use to get this information?

    
asked by anonymous 07.03.2016 / 20:16

1 answer

2

There are some commercial tools that can do this, but I've never used them.

In essence, you should measure the time elapsed in the% method call and related methods.

What is usually done in the companies where I worked is instrumentalize the instances of executeQuery , Connection and correlates to measure the times. Unfortunately each has a solution.

Here at Atlassian we have a plugin for JIRA that, when loaded, is able to modify classes at runtime and thus collect profiling information.

This is done using a java agent , which makes it possible to add instrumentation to classes. See the Java documentation for more details.

There is a tutorial on how to make a mini profiler using instrumentation here . p>

The simplest alternative is to simply inject your summer from Statement and related classes into the other classes of your system, as I mentioned above.

    
08.03.2016 / 05:00