English
[Interview Question] What is a Connection Pool? (Feat. ChatGPT)

[Interview Question] What is a Connection Pool? (Feat. ChatGPT)

Organizing interview questions about DB Connection Pools

What is DB Connection Pool?

Store objects that have already connected to the DB in the pool. Borrow the connection when a client requests it When processing is finished, return the connection and save it back to the Pool

I think you can understand that it is like a connection object that is connected in advance and then retrieved when needed.

Why use it?

For Java Spring,

  • If you're using a direct connection to the DB for processing, you can use the

  • Need to load the JDBC Driver and get the connection object each time

  • Driver loading, object creation, and connection is repeated for each request

→ This is very inefficient, so we use Connection Pools to solve these problems.

+ Other frameworks also use it.

Features

  • Pre-created in the Connection object pool when WAS runs

  • Get, write and return objects based on HTTP requests

  • No connection, creation time consumed per Connection request → Reduces connection load

  • What if the number of concurrent connections is more than the number of objects in the pool? → If there are not enough pre-created connection objects, wait in order until returning

Larger pools consume more memory and reduce latency.

댓글 작성

게시글에 대한 의견을 남겨 주세요.

댓글 0