ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Apache Common DBCP removeAbandoned 옵션 설명
    DATABASE 2014. 10. 21. 22:37
    반응형

    참여하고 있는 프로젝트의 DB 성능 향상을 위한 회의에서 removeAbandoned 옵션에 대해 엔지니어간에 서로 다른 내용의 이야기를 하는 바람에 확인을 하느라 많은 시간이 소비 되었다.

    이 옵션은 아파치의 Common DBCP 에서 제공하는 옵션으로 사이트에 잘 설명이 되어 있다.

    혹시 또 이 이슈로 문제가 될까하여, 정리해 놓는다.

    removeAbandoned
        - default false.
        - Flag to remove abandoned connections if they exceed the removeAbandonedTimout. (removeAbadonedTimeout 에 지정된 시간이 지났을 때 버려진 연결을 제거한다.)
        - If set to true a connection is considered abandoned and eligible for removal if it has not been used for longer than the removeAbandonedTimeout. (true 로 설정하면 removeAbandonedTimeout 에 지정된 시간이상 사용하지 않은 경우는 연결이 중단되어 제거 가능한 것으로 간주한다.)
        - Creating a Statement, PreparedStatement or CallableStatement or using one of these to execute a query (using one of the execute methods) resets the lastUsed property of the parent connection. (Statement, PreparedStatement 또는 CallableStatement 를 생성하거나, 이들을 이용하여 하나 이상의 쿼리가 실행 되면, connection의 lastUsed 속성이 초기화 된다.)
        - Setting this to true can recover db connections from poorly written applications which fail to close a connection. (true 로 설정하면 어플리케이션에서 연결을 종료하는데 실패한 db connection 을 복구 할 수 있다.)
       
    removeAbadonedTimeout
        - default 300.
        - Timeout in seconds before an abandoned connection can be removed. ( 버려진 여결을 삭제하기 전 대기 시간을 설정한다. )
     
    logAbandoned
        - default false
        - Flag to log stack traces for application code which abandoned a Statement or Connection. (설정을 할 경우 버려진 연결에 대해 stack trace 에 기록한다.)
        - Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated. (기록을 남기길 원할 경우 모든 오버해드가 발생한다.)
       
       
     If you have enabled "removeAbandoned" then it is possible that a connection is reclaimed by the pool because it is considered to be abandoned. This mechanism is triggered when (getNumIdle() < 2) and (getNumActive() > getMaxTotal() - 3)
    removeAbandoned을 사용하도록 설정 한 경우, 다음의 경우 버려진 것으로 간주되기 때문에 연결이 풀에서 삭제 될수 있다. 이 메커니즘은 다음 조건에 트리거 된다. (getNumIdle () <2)와 (getNumActive ()> getMaxTotal () - 3)

    For example, maxTotal=20 and 18 active connections and 1 idle connection would trigger the "removeAbandoned". But only the active connections that aren't used for more then "removeAbandonedTimeout" seconds are removed, default (300 sec). Traversing a resultset doesn't count as being used. Creating a Statement, PreparedStatement or CallableStatement or using one of these to execute a query (using one of the execute methods) resets the lastUsed property of the parent connection.
    예를 들어, maxTotal=20 이고  사용중인 커넥션이 18 개이고  1개의 유휴 커넥션이 있을 경우 removeAbandoned 는 트리거 된다. 그러나 그 후에 removeAbadonedTimeout 에 설정된 시간(기본 300초) 동안 사용하지 않은 경우에만 제거된다.



    원문에 대한 번역은 오역이 있을 수 있으므로, 결과에 대한 책임은 지지 않는다. 될 수 있으면, 원문을 보고 판다하길 바란다.

    반응형
Designed by Tistory.