티스토리 뷰

상황

200개의 리퀘스트를 던지는 부하테스트 중에 max DB connection pool을 200으로 설정하면 아래와 같은 에러가 발생함.

### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: could not open file "base/16384/16729": Input/output error
### The error may exist in jp/co/toppan/aiocr/bpo/app/domain/repository/EntryRepository.java (best guess)
### The error may involve jp.co.toppan.aiocr.bpo.app.domain.repository.EntryRepository.selectEntryByStatus-Inline
### The error occurred while setting parameters
### SQL: SELECT -생략-
### Cause: org.postgresql.util.PSQLException: ERROR: could not open file "base/16384/16729": Input/output error
; ERROR: could not open file "base/16384/16729": Input/output error; nested exception is org.postgresql.util.PSQLException: ERROR: could not open file "base/16384/16729": Input/output error
org.springframework.dao.DataAccessResourceFailureException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: could not open file "base/16384/16729": Input/output error
### The error may exist in Repository.java (best guess)
### The error may involve Repository.selectEntryByStatus-Inline
### The error occurred while setting parameters
### SQL: SELECT -생략-
### Cause: org.postgresql.util.PSQLException: ERROR: could not open file "base/16384/16729": Input/output error
; ERROR: could not open file "base/16384/16729": Input/output error; nested exception is org.postgresql.util.PSQLException: ERROR: could not open file "base/16384/16729": Input/output error
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:107)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)

 

해결

  • 당연한 얘기지만 max DB connection pool을 좀 더 작게 설정하면 해결됨.
  • 200으로 바꾼 이유는 100으로 했을 때 DB connection을 가져올 때 10초이상 대기하는 문제가 있어서였는데 150으로 조정했더니 길어도 426ms에는 가져올 수 있었음.
  • 200유저가 로그인한 상태라 connection pool만 문제였는지도 의문이기도하고 테스트 환경이 로컬머신이라 늦었던 것도 있을 것 같음