본문 바로가기

APM/Jennifer

[Jennifer5] JDBC 모니터링 방식 정리 & Troubleshooting

#01. Type5 (Jennifer5 에서 많이 사용하는 방식 - Default 세팅)

WAS서버에서 데이터소스 생성하여 DB Connection을 맺는 경우,

Type5 세팅으로 대부분 모니터링 가능하다.

 

옵션 세팅

enable_datasource_trace = true (기본값)
-------------------------------------------------------
enable_sql_pointcut = true (기본값)
-------------------------------------------------------
Connection pool 개수 : db_connection_count
-------------------------------------------------------
profile db open,close : db_connection_get, db_connection_close
-------------------------------------------------------
sql 정보 : profile_sql_callablestatement, 
           profile_sql_preparedstatement, 
           profile_sql_resultset, 
           profile_sql_statement
-------------------------------------------------------

 

 


 

문제상황 01. Active DB Connection 수 수집 불가 현상

아래 옵션 추가

<Tibero DB>
db_connection_count = com.tmax.tibero.jdbc.driver.TbConnection

<cubrid DB>
db_connection_count = cubrid.jdbc.driver.CUBRIDConnection

<hikari CP>
com.zaxxer.hikari.pool.HikariProxyConnection

 

 


 

문제상황 02. SQL 데이터 수집 불가 현상

Tibero DB의 경우, 우선 아래 옵션을 변경해본다

enable_tibero_sql_pointcut = true (기본값 false)

 

 

그 외 DB서버의 경우, 아래 옵션 추가

Tibero DB의 경우, enable_tibero_sql_pointcut 옵션 변경 후에도 SQL문 수집 불가할 시에 아래 옵션 추가해보기

<Tibero DB>

 - profile_sql_statement
com.tmax.tibero.jdbc.driver.TbStatement

 - profile_sql_preparedstatement
com.tmax.tibero.jdbc.driver.TbPreparedStatement
com.tmax.tibero.jdbc.driver.TbPreparedStatementImpl

 - profile_sql_callablestatement
com.tmax.tibero.jdbc.driver.TbCallableStatement
com.tmax.tibero.jdbc.driver.TbCallableStatementImpl

 - profile_sql_resultset
com.tmax.tibero.jdbc.driver.TbResultSetBase

----------------------------------------------

<MYSQL>

 - profile_sql_callablestatement
com.mysql.jdbc.CallableStatement
com.mysql.cj.jdbc.CallableStatement (커넥터8버전 이상)
 
 - profile_sql_preparedstatement
com.mysql.jdbc.PreparedStatement
com.mysql.jdbc.ClientPreparedStatement
com.mysql.cj.jdbc.PreparedStatement (커넥터8버전 이상)
com.mysql.cj.jdbc.ClientPreparedStatement (커넥터8버전 이상)
 
 - profile_sql_resultset
com.mysql.jdbc.ResultSetImpl
com.mysql.cj.jdbc.ResultSetImpl (커넥터8버전 이상)

 - profile_sql_statement
 com.mysql.jdbc.Statement
 com.mysql.cj.jdbc.Statement (커넥터8버전 이상)

----------------------------------------------

 

 


 

Tibero DB 사용 환경에서 enable_tibero_sql_pointcut = true 했을 시 에러 상황

해당 옵션 enable 후, WAS 서버 재기동 하지 않아도 SQL문 모니터링은 가능했으나,

WAS 서버 재기동 시 아래와 같은 에러가 발생하는 경우가 있음.

 

Caused by: java.lang.NoSuchFieldError: _j5_jf_param_
        at com.tmax.tibero.jdbc.driver.TbPreparedStatement.<init>(Unknown Source)

 

제조사 측 문의 결과 해당 에러는 제니퍼 영향이 맞다고 한다.

에이전트 고급옵션에서 enable_tibero_sql_pointcut 및 profile_sql_*** 옵션들을 전부 제거 후

jdbc_wrapper 로 설정해야 함.

 

jdbc_wrapper 만 enable 후 WAS 재기동 시 문제 발생 안했음.

 


 

#02. Type3 (Jennifer4 에서 많이 사용하는 방식)

소스 단에서 DB Connection Pool 생성하는 구조일 경우, Type5로 DB 모니터링이 되지 않을 수 있다.

이럴 경우에는 Type3 형태로 변경해보도록 한다.

 

옵션 세팅

enable_jdbc_wrapper = true
------------------------------------------------
enable_datasource_trace = false
------------------------------------------------
enable_reserved_context_pointcut = false
------------------------------------------------
enable_sql_pointcut = false
   db_connection_get 옵션이 예전 방식의 Type3 추적방식으로 바뀜.
   profile의 Connection, sql과 Connection pool 개수 모니터링이 같이 적용됨.
------------------------------------------------
db_connection_get, db_connection_close
   각각 java.sql.Connection 객체를 리턴하는 메소드 등록
------------------------------------------------

 

 

위의 옵션 적용 후에도 SQL 정보가 보이지 않을 경우, 아래 옵션 변경

enable_non_servlet_thread_jdbc_trace = true (기본값 false)

 

 


 

#03. Active DB Connection 값 수집이 안되는 경우

jmx 설정 적용해보기