Skip to content

fix: Prevent cold-path JVM/Hibernate latency after extended idle periods#69

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-elevated-backend-latency
Draft

fix: Prevent cold-path JVM/Hibernate latency after extended idle periods#69
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-elevated-backend-latency

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

After 3.5+ hours of zero traffic, first requests to GET /api/cards spiked to 3120ms avg / 4681ms max (baseline <500ms) due to stacked cold-path costs: stale HikariCP connections, cold Hibernate query plan cache, and JIT deoptimization.

Changes

application.yml

  • show-sql: false — removes per-query SQL logging overhead (was true)
  • HikariCP keep-alive — prevents connection pool going stale during idle:
    hikari:
      connection-test-query: SELECT 1
      keepalive-time: 300000ms   # heartbeat every 5 min
      idle-timeout: 600000ms     # evict connections idle >10 min
  • warmup.* properties — externalizes scheduler delays for per-environment tuning

WarmupService.java (new)

  • @Scheduled bean that calls getAllCreditCards() every 5 minutes (1-min initial delay), keeping JIT hot, Hibernate query plan cache warm, and HikariCP pool active between real traffic bursts
  • Delays driven by warmup.fixed-delay / warmup.initial-delay properties
  • Exceptions are caught and logged as warnings — warmup failure never affects request path

ThreeRiversBankApplication.java

  • Added @EnableScheduling to activate the warmup task

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Fix elevated backend latency on cold-path JVM warm-up fix: Prevent cold-path JVM/Hibernate latency after extended idle periods Mar 24, 2026
Copilot AI requested a review from yortch March 24, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Incident] Elevated Backend Latency — Cold-Path JVM/Hibernate Warm-up After Idle Period

2 participants