Skip to content

Optimize HikariCP connection pooling across all microservices#4

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1755822286-optimize-hikari-connection-pooling
Open

Optimize HikariCP connection pooling across all microservices#4
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1755822286-optimize-hikari-connection-pooling

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 22, 2025

Copy link
Copy Markdown

Optimize HikariCP connection pooling across all microservices

Summary

Added HikariCP connection pool optimization configuration to all four banking microservices (User-Service, Account-Service, Fund-Transfer, Transaction-Service) to improve database performance and resource utilization. The changes add standardized connection pooling settings including pool sizes, timeouts, and connection validation.

Key Changes:

  • User-Service & Account-Service: maximum-pool-size: 10 (standard load services)
  • Fund-Transfer & Transaction-Service: maximum-pool-size: 15 (higher transaction volume services)
  • Timeout configuration: 60s connection timeout, 10min idle timeout, 30min max lifetime
  • Added connection validation with connection-test-query: SELECT 1

Review & Testing Checklist for Human

  • Verify pool sizes align with actual service load patterns - The pool sizes (10/15) are based on general recommendations but should be validated against real traffic data
  • Test database connectivity with new HikariCP configuration - Ensure all services can successfully connect to their MySQL databases and acquire connections from the pool
  • Verify 60-second connection timeout is appropriate - The timeout was increased from 30s based on feedback, but should be validated against your database response times and network conditions
  • Monitor connection pool metrics after deployment - Watch for connection timeouts, pool exhaustion, or resource waste in production
  • Load test critical banking workflows - Test fund transfers and high-volume transaction flows to ensure the higher pool sizes (15) are sufficient

Recommended Test Plan:

  1. Start all microservices locally with MySQL running
  2. Execute typical banking workflows (user registration, account creation, fund transfers, transactions)
  3. Monitor HikariCP pool metrics via actuator endpoints if available
  4. Perform load testing on Fund-Transfer and Transaction services specifically

Diagram

%%{ init : { "theme" : "default" }}%%
graph TB
    subgraph "Banking Microservices"
        US["User-Service<br/>application.yml"]:::major-edit
        AS["Account-Service<br/>application.yml"]:::major-edit
        FT["Fund-Transfer<br/>application.yml"]:::major-edit
        TS["Transaction-Service<br/>application.yml"]:::major-edit
    end
    
    subgraph "Database Layer"
        DB[("MySQL Databases")]:::context
    end
    
    US --> |"HikariCP pool: 10<br/>timeout: 60s"| DB
    AS --> |"HikariCP pool: 10<br/>timeout: 60s"| DB  
    FT --> |"HikariCP pool: 15<br/>timeout: 60s"| DB
    TS --> |"HikariCP pool: 15<br/>timeout: 60s"| DB
    
    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

  • All services already had MySQL connector dependency, so HikariCP is available by default in Spring Boot 2.7+
  • Configuration follows Spring Boot HikariCP property naming conventions
  • Higher pool sizes assigned to Fund-Transfer and Transaction services based on expected higher transaction volumes
  • Connection timeout increased from 30s to 60s based on reviewer feedback to accommodate complex banking operations
  • No breaking changes - existing database configuration patterns preserved

Session Details:

- Add HikariCP configuration to User-Service (pool size: 10)
- Add HikariCP configuration to Account-Service (pool size: 10)
- Add HikariCP configuration to Fund-Transfer (pool size: 15)
- Add HikariCP configuration to Transaction-Service (pool size: 15)
- Configure connection timeouts, idle settings, and test queries
- Higher pool sizes for transaction-heavy services (Fund-Transfer, Transaction-Service)

This optimization improves database connection management, reduces connection
acquisition times, and prevents connection leaks across all microservices.

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

@samfert

samfert commented Aug 22, 2025

Copy link
Copy Markdown
Owner

Timeout should be longer

- Update connection-timeout from 30000ms to 60000ms across all microservices
- Allows more time for complex banking database operations to complete
- Addresses PR feedback requesting longer timeout values

Co-Authored-By: Sam Fertig <sam.fertig@codeium.com>
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.

1 participant