Quantcast
Channel: Active questions tagged redis+java - Stack Overflow
Viewing all articles
Browse latest Browse all 2204

Quarkus Redis Client is creating huge amount of connections

$
0
0

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. Elasticache Current Connections

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}:6379quarkus.redis.cache.client-type=clusterquarkus.redis.cache.replicas=share

Viewing all articles
Browse latest Browse all 2204

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>