Hi Everyone,
I have a simple table(with name MyEntity) in my MySQL database containing 7 columns.
I have defined a JpaRepo as follows:
@Repository
public interface MyEntityRepository extends JpaRepository<MyEntity, String> {
static final String QUERY = "SELECT * FROM MyEntity WHERE type = ?1 AND (IF(?2 IS NULL, TRUE, (id = ?2)))";
@Query(value=QUERY, nativeQuery=true)
public List<MyEntity> searchByTypeAndId(String searchType, String searchId);
}
I am doing performance testing on this app. Each query will result in 10 records getting returned. Each record will weigh around 9KB. So the resultSet of each query will weigh around 90KB. During this testing, searchId will always be null.
At around 360tps(transactions per second), I am observing a huge delay in the query execution.
Related Logs:
“Session Metrics {128580242 nanoseconds spent acquiring 1 JDBC connections; 0 nano seconds spent releasing 0 JDBC connections; 128615605 nanoseconds spent preparing 1 JDBC statements; 18416500 nanoseconds spent executing 1 JDBC statements; 0 nanoseconds spent executing 0 JDBC batches; 0 nanoseconds spent performing 0 L2C puts;0 nanoseconds spent performing 0 L2C hits; 0 nanoseconds spent performing 0 L2C misses; 0 nanoseconds spent executing 0 flushes (flushing a total of 0 entities and 0 collections);0 nanoseconds spent executing 0 partial-flushes (flushing a total of 0 entities and 0 collections)}”
- 128.580242ms for acquiring 1 JDBC connections is pretty huge.
- 128.615605ms for preparing 1 JDBC statements is also pretty huge.
- 18.416500ms for executing 1 JDBC statements is fine.
Why are points 1 and 2 so high?
What do those values depend on?
Thanks in Advance.