-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallel Request Issue #412
Comments
@vfssantos Thanks for the feedback!
We would like to support these features in |
Just want to point-out that the Therefore I guess the distinguishing feature is the auto-pipelining. Implementing a connection pool outside of the client itself is trivial, using the same import { connect, type Redis } from "https://deno.land/x/redis/mod.ts";
import { createPool } from "npm:generic-pool";
const redisPool = createPool<Redis>({
create: async () => connect({ hostname: "127.0.0.1", port: "6379" }),
destroy: async (client) => client.close(),
}, { max: 20, min: 1 });
const startTime = new Date().getTime();
const promiseResponse = Array(100).fill(0).map(async () => {
const redisClient = await redisPool.acquire();
const res = await redisClient.get("foo");
await redisPool.release(redisClient);
console.log("time", new Date().getTime() - startTime);
return res;
});
const res = await Promise.all(promiseResponse);
// Drain the pool during shutdown
await redisPool.drain();
await redisPool.clear(); It does indeed perform better, at the cost of more connections. Personally I'm fine implementing the pool myself, I like to keep the client simple 🤷 EDIT: BTW, on |
I'm experiencing a performance issue with this module, that does not happen using 'npm:redis' module for Deno.
Basically, using a singleton instance
If I perform many parallel request using this same connection, such as:
It looks like the requests are being performed sequentially, instead of in parallel. Here are the "time" logs for a test I've performed:
The fact that it it consistently increasing indicates that there's something not allowing the requests to be performed in parallel with this lib.
However, using the exact same code, but importing the 'redis' module from NPM, as
Here's the result:
Which clearly indicates that in fact the request ar being performed in parallel.
Is this the expected behavior of this module, or am I missing something here; or this behavior is indeed something which was not expected in this module?
The text was updated successfully, but these errors were encountered: