RedisSentinel with MaxWritePoolSize Settings

I’ve started to work with RedisSentinel Class recently. i use the following code to get my client manager

_cacheClientManager = (PooledRedisClientManager)_redisSentinel.Start();

the thing is that the system has many services that contacts my cache service and while using the PooledRedisClientManager the default : MaxWritePoolSize = 10 , MaxReadPoolSize = 10
is not sufficient and i get blocked services and timeout exceptions when my write clients in use reach 10.

the older (non sentinel supported ) code was working well :
_cacheClientManager = new PooledRedisClientManager(rwHosts,roHosts, new RedisClientManagerConfig
MaxWritePoolSize = 20 ,
MaxReadPoolSize = 10,
AutoStart = true

i did not find a way to configure the same settings of the poolsize with the RedisSentinel

please provide an example how can it be done


You can customize the creation of Redis Manager that RedisSentinel uses by providing a custom RedisSentinel.RedisManagerFactory.FactoryFn for the default impl see:

Thank you very much
i had managed to make it work as you had suggested

on my cache wrapper i had added a Custom Redis Client Manager :

private static IRedisClientsManager CreateCustomPooledRedisClientManager(
IEnumerable readWriteHosts,
IEnumerable readOnlyHosts)
return readOnlyHosts.Any()
? new PooledRedisClientManager(readWriteHosts, readOnlyHosts,new RedisClientManagerConfig
MaxWritePoolSize = 40,
MaxReadPoolSize = 20,
AutoStart = true
: new PooledRedisClientManager(readWriteHosts.ToArray());


and use it as follows :

_redisSentinel.RedisManagerFactory.FactoryFn = CreateCustomPooledRedisClientManager;

_cacheClientManager = (PooledRedisClientManager)_redisSentinel.Start();