yuqi1129 opened a new pull request, #10734: URL: https://github.com/apache/gravitino/pull/10734
### What changes were proposed in this pull request? Fix two DBCP2 connection pool settings in `SqlSessionFactoryHelper` that cause cold-start latency after idle periods: | Setting | Before | After | |---|---|---| | `minIdle` | `0` | `5` | | `minEvictableIdleTimeMillis` | `1000` (1 s) | `Duration.ofSeconds(30).toMillis()` (30 s) | ### Why are the changes needed? The evictor thread runs every 10 minutes. With `minEvictableIdleTimeMillis = 1s`, every connection idle ≥ 1 s is eligible for eviction — so after any 10-minute quiet period **all** connections are evicted. With `minIdle = 0` the pool shrinks to zero, and the next burst of requests must each pay a DB connection-establishment cost (TCP handshake + auth, typically 20–100 ms on MySQL/PostgreSQL). This is particularly impactful when the entity store cache is disabled, as every auth request then issues 3+ DB queries against a potentially-empty connection pool. `minEvictableIdleTimeMillis = 1000ms` also reads as a suspicious dev/test value. Using `Duration.ofSeconds(30)` makes the intent explicit and prevents over-aggressive eviction if the evictor interval is ever shortened. Fix: #10733 ### Does this PR introduce _any_ user-facing change? No. Connection pool settings are internal; behavior change is reduced latency after idle periods. ### How was this patch tested? Existing unit tests cover `SqlSessionFactoryHelper` initialization. The pool config values are applied at startup; behavioral correctness is validated by integration tests against H2/MySQL. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
