Skip to content
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

[QUESTION] READONLY requests using Async API #75

Open
psykro opened this issue Mar 25, 2022 · 2 comments
Open

[QUESTION] READONLY requests using Async API #75

psykro opened this issue Mar 25, 2022 · 2 comments

Comments

@psykro
Copy link

psykro commented Mar 25, 2022

Hello,

I'm trying to use the Async API. Everything works fine, the load is balanced on my masters. My test software shows an output of 160k req/s (only GET commands)
If I set my connection to READONLY, only the 3 master instances seems to be used (doing a simple "top" shows only 3 instances working)

Here is a code extract of what i do (removed error checks):

redisClusterAsyncContext * cc = redisClusterAsyncConnect("127.0.0.1:30001", HIRCLUSTER_FLAG_NULL);
uv_loop_t * loop = (uv_loop_t *)malloc(sizeof(uv_loop_t));
uv_loop_init(loop);
redisClusterLibuvAttach(cc, loop);
redisClusterAsyncContext(cc, "READONLY");
redisClusterAsyncCommand(cc, &__cb_getKey, &priv, "GET key");

Is this the correct way to handle this ? Also what is the purpose of the second parameter of redisClusterAsyncConnect ?

Thanks

@bjosv
Copy link
Collaborator

bjosv commented Mar 29, 2022

hiredis-cluster does not support the READONLY part of the example.
Currently it only uses the known masters when finding out whom to send the command to, but it might be a nice feature.
I believe you would need to make sure the READONLY command is sent to all nodes, have some state and make changes to node_get_by_table().

The second argument in redisClusterAsyncConnect is legacy and its an alternative way to set configuration flags.

@psykro
Copy link
Author

psykro commented Mar 29, 2022

Thanks for you answer.
That's sad :(

I don't think i'll have time to work on this, would have been a great addition but load balancing on 3 Masters is already a great thing 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants