Last year I posted a thread on Partitioning Redis. At the time I went with the solution of creating different DTO objects for different classes of service, which of course works beautifully (thanks Mythz).
I’m now at the point where I have multiple instances of a single service and need to broker messages to each one, via REDIS. note, that its not a load balancer scenario, its a scenario where the services have connections and therefore manage state, and i must get the message to the exact instance of the service.
I am considering the following approach:
- Group each instance of the service with its own Redis instance. This has lots of benefits.
- The broker will send a message to the redis instance on that server
- The message will be picked up and processed by the correct shard.
In order to do this, I need to dynamically manage redis client connections. Currently my RedisQueueProvider : IQueueProvider class manages only one connection to a redis instance, I am considering padding this out to manage multiple redis connections. (A pool of pools effectively)
Is this the correct approach, or is there a built in sharding mechanism that I can use for this?