Feature Request: Pooling
Add a Option when creating a Redis for: pool: { min: number = 10, max: number = 250 }
This increases production, not having to code it manually with e.g. https://npmjs.org/generic-pool
It would just add a couple functions in all execution methods:
// example:
async function executeRedisCommand(method, ...extras) {
const clientOfPool = await redis.pool.acquire();
const res = clientOfPool[method](...extras);
await redis.pool.release(conn);
return res;
}
Thanks!
What commands are you running? Have you tried https://github.com/luin/ioredis#autopipelining ?
Hi @TysonAndre , Reading autopipelining docu:
When using Redis Cluster, one pipeline per node is created. Commands are assigned to pipelines according to which node serves the slot. A pipeline will thus contain commands using different slots but that ultimately are assigned to the same node. Note that the same slot limitation within a single command still holds, as it is a Redis limitation.
To make sure i understand, autopipieline is supported with any key that i use right? multiple keys (even in same node) are scattered among different hash slot (According to key) - so this sill works? if some keys (in same node) are scattered in 3 hashslot, there wil be one pipeline with 3 commands?
what are the drawbacks or when not to use autopipelining ?
Will it be more beneficial to create pooling? (or in addition to autopipelining) multiple connections working on same redis will work fast? or delay other connections?
thanks, Tal