Skip to content

Optimize HikariCP Connection Pooling for Database Microservices#5

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1755877962-optimize-hikari-connection-pooling
Open

Optimize HikariCP Connection Pooling for Database Microservices#5
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1755877962-optimize-hikari-connection-pooling

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Optimize HikariCP Connection Pooling for Database Microservices

Summary

This PR adds optimized HikariCP connection pool settings to all four database-connected microservices in the banking application: User Service, Account Service, Fund Transfer Service, and Transaction Service. The changes improve database performance by configuring connection pool parameters that manage database connections more efficiently.

Changes made:

  • Added HikariCP configuration to application.yml files in 4 services
  • Configured consistent pool settings: max-pool-size=10, min-idle=5, idle-timeout=5min, connection-timeout=20s, max-lifetime=20min
  • All changes are configuration-only with no code modifications
  • Verified YAML syntax by successful compilation of all affected services

Review & Testing Checklist for Human

  • Test database connectivity - Verify each service can still connect to MySQL with the new HikariCP settings
  • Validate pool size settings - Confirm maximum-pool-size=10 and minimum-idle=5 are appropriate for each service's expected load patterns
  • Check for runtime errors - Start each service and monitor logs for any connection pool related errors
  • Performance verification - Optionally run load tests to verify the connection pooling improves performance vs baseline

Recommended test plan: Start all 4 database-connected services locally with MySQL running and verify they start successfully without connection errors. Test basic CRUD operations for each service to ensure database connectivity works properly with the new connection pool settings.


Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    UserService["User-Service/src/main/resources/<br/>application.yml"]:::major-edit
    AccountService["Account-Service/src/main/resources/<br/>application.yml"]:::major-edit  
    FundTransfer["Fund-Transfer/src/main/resources/<br/>application.yml"]:::major-edit
    TransactionService["Transaction-Service/src/main/resources/<br/>application.yml"]:::major-edit
    
    MySQL[(MySQL Database)]:::context
    HikariCP[HikariCP Connection Pool<br/>Settings Added]:::context
    
    UserService --> MySQL
    AccountService --> MySQL
    FundTransfer --> MySQL
    TransactionService --> MySQL
    
    HikariCP -.-> UserService
    HikariCP -.-> AccountService
    HikariCP -.-> FundTransfer
    HikariCP -.-> TransactionService
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit
        L3[Context/No Edit]:::context
    end
    
    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

Configuration Details:
The HikariCP settings applied provide conservative defaults suitable for microservices:

  • maximum-pool-size: 10 - Prevents resource exhaustion while allowing reasonable concurrency
  • minimum-idle: 5 - Maintains ready connections for quick response times
  • idle-timeout: 300000ms (5 min) - Releases unused connections to free resources
  • connection-timeout: 20000ms (20 sec) - Prevents hanging on connection acquisition
  • max-lifetime: 1200000ms (20 min) - Ensures periodic connection refresh

Testing Limitation: This PR was only validated through successful compilation. Runtime testing with actual database connections is required to ensure the configuration works correctly in practice.

Link to Devin run: https://app.devin.ai/sessions/60fd475bc65744ee87526aac922f5295
Requested by: @samfert-codeium

- Add HikariCP connection pool settings to User Service, Account Service, Fund Transfer Service, and Transaction Service
- Configure maximum-pool-size: 10, minimum-idle: 5 for optimal resource management
- Set idle-timeout: 300000ms, connection-timeout: 20000ms, max-lifetime: 1200000ms
- Improves database performance by managing connections more efficiently

Co-Authored-By: Sam Fertig <sam.fertig@codeium.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants