Tuning the database connection pool
Database connections are an expensive resource that can take some time when they’re created for the first time. For that reason, Spring Boot uses a technique known as connection pooling. When a connection pool is used, the application doesn’t create a direct connection to the database; instead, it requests an available connection to the connection pool. When the application doesn’t need a connection, it returns it to the pool. The connection pool usually creates some connections at the start of the application. When the connections are returned to the pool, they are not closed but reused by other parts of the application.
A common challenge when operating applications is deciding on the connection pool size. If the size is too small, under a certain load, some requests will take longer as they wait for a connection to become available in the pool. If the connection pool is too large, it will waste resources in the database...