You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have an RDS Aurora MySQL cluster with two instances (writer and reader), and I’m trying to follow the SpringHibernateBalancedReaderTwoDataSourceExample to reduce the load on the writer instance.
Everything seems to work fine, but when I attempt to set a custom Hikari configuration, as described in the commented section of the example , it doesn’t get applied. This appears to be because the HikariPooledConnectionProvider's acceptsUrl method does not accept cluster type URL, so it uses a default provider.
Expected Behavior
Set a custom HikariConfig and print the log inside the HikariPoolConfigurator's configurePool method when a connection pool is created.
What plugins are used? What other connection properties were set?
Using a custom profile starting from the SF_F0 preset (details in additional info section)
Modify the acceptsUrl method in HikariPooledConnectionProvider
Additional Information/Context
My custom profile:
static {
ConfigurationProfileBuilder.get().from(ConfigurationProfilePresetCodes.SF_F0)
.withName("datasource-with-internal-connection-pool")
.withConnectionProvider(new ClusterHikariPooledConnectionProvider(
(hostSpec, originalProps) -> {
LOGGER.info("Start a new HikariCP pool for {}", hostSpec.getHost());
final HikariConfig config = new HikariConfig();
config.setMaximumPoolSize(25);
// holds few extra connections in case of sudden traffic peak
config.setMinimumIdle(2);
// close idle connection in 15min; helps to get back to normal pool size after load peak
config.setIdleTimeout(TimeUnit.MINUTES.toMillis(15));
// verify pool configuration and creates no connections during initialization phase
config.setInitializationFailTimeout(-1);
config.setConnectionTimeout(TimeUnit.SECONDS.toMillis(10));
// validate idle connections at least every 3 min
config.setKeepaliveTime(TimeUnit.MINUTES.toMillis(3));
// allows to quickly validate connection in the pool and move on to another connection if needed
config.setValidationTimeout(TimeUnit.SECONDS.toMillis(1));
config.setMaxLifetime(TimeUnit.DAYS.toMillis(1));
config.setAutoCommit(false);
return config;
},
null
))
.buildAndSet();
}
Describe the bug
Hi,
I have an RDS Aurora MySQL cluster with two instances (writer and reader), and I’m trying to follow the SpringHibernateBalancedReaderTwoDataSourceExample to reduce the load on the writer instance.
Everything seems to work fine, but when I attempt to set a custom Hikari configuration, as described in the commented section of the example , it doesn’t get applied. This appears to be because the HikariPooledConnectionProvider's acceptsUrl method does not accept cluster type URL, so it uses a default provider.
Expected Behavior
Set a custom HikariConfig and print the log inside the HikariPoolConfigurator's configurePool method when a connection pool is created.
What plugins are used? What other connection properties were set?
Using a custom profile starting from the SF_F0 preset (details in additional info section)
Current Behavior
The HikariPooledConnectionProvider is never used.
Reproduction Steps
Follow the SpringHibernateBalancedReaderTwoDataSourceExample with an Aurora mysql cluster
Possible Solution
Modify the acceptsUrl method in HikariPooledConnectionProvider
Additional Information/Context
My custom profile:
application.yml:
The AWS Advanced JDBC Driver version used
2.3.9
JDK version used
17
Operating System and version
windows 11
The text was updated successfully, but these errors were encountered: