Connection Pool 란?

서버가 DB에 연결하기 위한 Connecting 비용이 가장 큰 비율을 차지한다. 이처럼 Connection을 생성하는 작업은 비용이 많이 드는 작업이다. 이를 보완할 수 있는 방법이 바로 Connection Pool이다. 커넥션 풀은 데이터베이스와 연결된 커넥션을 미리 만들어 놓고 이를 pool로 관리하는 것이다. 즉, 필요할 때마다 커넥션 풀의 커넥션을 이용하고 반환하는 기법이다.
커넥션 풀 디자인 패턴처럼 미리 만들어 놓은 커넥션을 이용하면 Connection에 필요한 비용을 줄일 수 있다. 따라서 DB에 빠르게 접속할 수 있다.
HikariCP 란?
HikariCP는 가벼운 용량과 빠른 속도를 가지는 JDBC의 커넥션 풀 프레임워크이다. SpringBoot는 커넥션 풀 관리를 위해 HikariCP를 사용한다고 한다.
아래의 사진으로 설명을 덧붙이겠다.


MySQL의 공식레퍼런스에서는 600여 명의 유저를 대응하는데 15~20개의 커넥션 풀만으로도 충분하다고 언급하고 있다.
아래의 래퍼런스를 보고 결정하는것이 좋을것 같다.
MySQL
MySQL :: MySQL Connector/J 8.1 Developer Guide :: 8 Connection Pooling with Connector/J
Chapter 8 Connection Pooling with Connector/J Connection pooling is a technique of creating and managing a pool of connections that are ready for use by any thread that needs them. Connection pooling can greatly increase the performance of your Java appl
dev.mysql.com
Number Of Database Connections - PostgreSQL wiki
You can often support more concurrent users by reducing the number of database connections and using some form of connection pooling. This page attempts to explain why that is. Summary A database server only has so many resources, and if you don't have eno
wiki.postgresql.org
위를 통해 성능 개선 해봤던 경험
2023-08-17 - JMeter / 성능 개선
1분동안 3000건 전체 조회 ( 페이지 ) OS 환경 Window 10 Pro RAM 32GB MySQL 8 PostgreSQL 15 Spring 3.1.2 JDK 17 기존 코드 @Transactional(readOnly = true) public List findAllIdea(String keyword, Category category, Integer page) { if (StringUti
domae.tistory.com
'Spring' 카테고리의 다른 글
| JPA - 기본 개념 (0) | 2023.12.27 |
|---|---|
| @Conditional (0) | 2023.12.21 |
| 테스트 도구 Apache JMeter (0) | 2023.08.11 |
| Spring interface 의존성 주입 (0) | 2023.07.31 |
| QueryDSL (1) (2) | 2023.07.10 |