-
Notifications
You must be signed in to change notification settings - Fork 29
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
pool of sockets #58
Comments
why would you use that? You can use one connection for all clients. |
In production, it is a best practice to manage a pool of sockets (which size is known), instead of creating one for all requests or by request. Another question : do you plan to handle a cluster of redis nodes with sentinels ? Thanks |
Issue with pool is that you need to track ownership of resources somehow. Once you say to pool giime_socet, this same person should give you this socket back in order to release resource. This kind of ordering is kind a hard to achieve not from implementation perspective, but from user perspective. If user does not release resource or it release before all futures completed you have misuse. Let imagine simple interface and here is example of use:
Do you spot bug and leaking resource? On the other hand, futures and cooperative approach in Dart enables you to have certain degree of trust that futures will not halt your execution. Using one connection for everybody is not that bad and messages cant get mixed up. Only exception are commands that affect connection for example calling command select changes database for connection and that would affect all users. Other that this kind of stuff, one just can't misuse and each user doesn't know that shares same connection with other users, just like they don’t know that they are all sharing same thread. |
Hey,
Congrats for the lib ! :)
Is there any plan of managing a pool of sockets instead of having to create one by connection ?
Thanks !
The text was updated successfully, but these errors were encountered: