r2dbc / r2dbc-pool

Connection Pooling for Reactive Relational Database Connectivity
https://r2dbc.io
Apache License 2.0
331 stars 55 forks source link

Connection acquisition timeout error in app at high traffic volume #186

Open htejwani opened 1 year ago

htejwani commented 1 year ago

We have a web-app with Spring Webflux that uses oracle-r2dbc with r2dbc-pool (v1.0.0.RELEASE). The app endpoints work fine at normal loads, however, when we test our app endpoint with 300 concurrent users, after a few minutes it starts failing with the "Connection Acquisition timeoout after 10000 ms" error.

Following is the configuration for r2db-pool: maxIdleTime: 10 mins maxValidationTime: 6 secs maxAcquireTime: 10 secs maxCreateConnectionTime: 10 secs validationDepth: REMOTE minIdle: 10 maxSize: 100

Some important points:

  1. Other endpoints that do not have DB interaction continue to work fine. The CPU and memory usage is normal.
  2. Even after the load test is done, the endpoint (with DB interaction) keeps failing with the same error as mentioned above. The app cannot recover from this error.
  3. The number of active connections in the DB after the load test are less than the minIdle number. The metrics for the pool shows more (almost double) idle connections than the idle connection in the DB but far less than the maxSize.
htejwani commented 1 year ago

This issue went away when we set the "protocol" property to "pool:oracle" instead of "oracle". With this change, the factory object set inside ConnectionPool class is of type ConnectionPool instead of OracleConnectionFactoryImpl.