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

Can the client be used by mutliple goroutines at a time ? #23

Closed
arnaudbriche opened this issue Jan 23, 2014 · 3 comments
Closed

Can the client be used by mutliple goroutines at a time ? #23

arnaudbriche opened this issue Jan 23, 2014 · 3 comments

Comments

@arnaudbriche
Copy link
Contributor

Hi,

Can a client be used from multiple goroutines concurrently ?
Also, to get the max out of redis, would you recommend to have multiple clients, or to set a higher pool size ?

@vmihailenco
Copy link
Collaborator

Can a client be used from multiple goroutines concurrently ?

Yes, *redis.Client is thread-safe, but *redis.Multi, *redis.Pipeline and *redis.PubSub are not (because I think that there is no compelling reasons to make them thread-safe).

would you recommend to have multiple clients, or to set a higher pool size ?

Definitely bigger pool, though default pool size (10 connections) is big enough for most use cases.

@arnaudbriche
Copy link
Contributor Author

Thx for the quick reply. Awesome work.

@DachuanZhao
Copy link

Can a client be used from multiple goroutines concurrently ?

Yes, *redis.Client is thread-safe, but *redis.Multi, *redis.Pipeline and *redis.PubSub are not (because I think that there is no compelling reasons to make them thread-safe).

would you recommend to have multiple clients, or to set a higher pool size ?

Definitely bigger pool, though default pool size (10 connections) is big enough for most use cases.

Is *redis.ClusterClient thread-safe ?

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

3 participants