Spring Boot

Performance Optimization

Performance optimization: profiling, caching, lazy loading, pagination, connection pooling, DB indexing

30 câu hỏi phỏng vấn·
Senior
1

What is HikariCP in the context of Spring Boot?

Câu trả lời

HikariCP is the default connection pool manager in Spring Boot since version 2.0. It offers exceptional performance through an optimized implementation (low overhead, efficient concurrency management) and is widely considered the fastest connection pool on the market. Spring Boot uses it automatically when spring-boot-starter-data-jpa or spring-boot-starter-jdbc is present in dependencies.

2

Which HikariCP parameter defines the maximum number of connections in the pool?

Câu trả lời

The maximumPoolSize parameter defines the maximum number of connections (active and idle) that HikariCP will maintain in the pool. The recommended value by HikariCP is generally based on the formula: connections = ((core_count * 2) + effective_spindle_count), often between 10 and 20 for typical applications. A value too high can saturate the database, while a value too low can cause connection waits.

3

What is the difference between maximumPoolSize and minimumIdle in HikariCP?

Câu trả lời

maximumPoolSize defines the total maximum number of connections (active and idle) in the pool, while minimumIdle defines the minimum number of idle connections that HikariCP maintains permanently. HikariCP recommends not setting minimumIdle and letting maximumPoolSize manage the pool (default behavior: minimumIdle = maximumPoolSize), as the pool automatically adjusts based on load to optimize performance.

4

What is the formula recommended by HikariCP to calculate maximumPoolSize?

5

Which HikariCP parameter controls the maximum wait time to obtain a connection from the pool?

+27 câu hỏi phỏng vấn

Nắm vững Spring Boot cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí