Connection Pool — HikariCP — Concept Check
Questions on Connection Pool — HikariCP. Spring Boot auto-configures HikariCP as the default connection pool; tuning maximumPoolSize, connectionTimeout, and keepaliveTime is critical for production.
Questions in this quiz
7 questions on Connection Pool — HikariCP — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A service using HikariCP is experiencing slow response times and frequent SQLTimeoutExceptions. What is the most likely cause?
- AIdle timeout is too short, causing frequent reconnections.
- BMaximum pool size is too low, causing request threads to queue.
- CConnection timeout is set too high, causing delays.
- DKeepalive time is too long, causing stale connections.
2.You notice that the `hikaricp_connections_pending` metric is consistently greater than zero. What should you do to resolve this?
- AIncrease the `idleTimeout` to keep connections alive longer.
- BIncrease the `maximumPoolSize` to handle more concurrent connections.
- CDecrease the `connectionTimeout` to reduce wait times.
- DDecrease the `keepaliveTime` to refresh connections more often.
3.Which configuration setting ensures that a HikariCP connection is not closed by the database server due to idleness?
- AkeepaliveTime
- BminimumIdle
- CconnectionTimeout
- DmaximumPoolSize
4.A developer sets `minimumIdle` to 5 and `maximumPoolSize` to 20. What is the effect of this configuration?
- AThe pool will keep at least 5 connections warm when idle.
- BThe pool will dynamically adjust between 5 and 20 connections.
- CThe pool will always maintain 20 connections, even when idle.
- DThe pool will close all connections when idle.
5.What happens if `maxLifetime` is set longer than the database server's `wait_timeout`?
- AThe pool will automatically adjust to match `wait_timeout`.
- BConnections will remain open indefinitely.
- CConnections may be closed by the server, causing errors.
- DNo impact, as HikariCP ignores server timeouts.
6.Which metric should you monitor to diagnose if HikariCP is experiencing pool exhaustion?
- Ahikaricp_connections_idle
- Bhikaricp_connections_timeout_total
- Chikaricp_connections_pending
- Dhikaricp_connections_active
7.In a system with 4 cores and 1 SSD, what is the recommended `maximumPoolSize` according to HikariCP's formula?
- A6
- B12
- C8
- D10