In my quarkus redis client, I am creating way more connections than my connection pool should allow. I am not sure why this is happening. My connection pool has maxPoolSize = 6 maxPoolWaiting = 24
but yet my elasticache service shows that my current connections on my shards went up to 1.4k and 700.
Why is this happening and how can I limit the amount of connections that my quarkus client is creating? This amount of connections is causing me the cache to have a high cpu usage which is not good for scaling.
I am using <quarkus.platform.version>2.16.4.Final</quarkus.platform.version>
This is the code I’ve been using to customize the RedisOptions.
@Override
public void customize(String clientName, RedisOptions options) {
NetClientOptions netOptions = options.getNetClientOptions();
netOptions.setSsl(true).setHostnameVerificationAlgorithm("HTTPS")
.setReconnectAttempts(reconnectAttempts).setReconnectInterval(reconnectInterval).setConnectTimeout(connectTimeout)
.setTcpKeepAlive(true).setIdleTimeout(5000).setIdleTimeoutUnit(TimeUnit.MILLISECONDS);
}
and this is how I am using the RedisClient in my code
@Inject
public CacheService(
@RedisClientName("cache") @NotNull ReactiveRedisDataSource reactiveRedisDataSource,
) {
commands = reactiveRedisDataSource.value(byte[].class);
keyCommands = reactiveRedisDataSource.key();
}
public Uni<Optional<Item>> getItem(String key) {
return commands.get(key).onItem().transform("turnFromBytestoItem");
}
and this is my connection logic in the application.properties
quarkus.redis.cache.hosts=rediss://${HOST:localhost}:6379
quarkus.redis.cache.client-type=cluster
quarkus.redis.cache.replicas=share