-
Notifications
You must be signed in to change notification settings - Fork 180
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
refactor to allow for a connection pool #113
base: main
Are you sure you want to change the base?
Conversation
We are using codis proxy on k8s which is backed by Azure Load Balancer. And we get timeouts whatever we try. Only true solution was implementing a connection pool of multiplexers. And all of timeout problems gone. But this implementation is in backend projects and using SE.Redis directly without session provider. And the frontend projects that use this session provider, get still this timeout exceptions. So I've found this PR when searching to implement/use pooling feature. @wjdavis5, have you created nuget package of this version. |
By the way our implementation is here: oruchreis/Nuve.DataStore@f9f211c#diff-9707258d90a3ac3b9214ba0f21929797R18 |
Hey @oruchreis - I have not created a nuget for this. |
I’m not sure this specific pooling implementation is what should be implemented. It should be factored with a pooling interface IRedisConnectionPool and the default implementation can use the concurrent queue. |
@wjdavis5, sorry about the delay but our team has been pretty busy. Especially disposing and recreating every single ConnectionMultiplexor every time there's a problem with one of the Multiplexors is expensive and will cause latency issues with larger pool sizes. Ideally, there would be a IConnection object that wraps around the ConnectionMultiplexor with CreateMultiplexor, CloseMultiPlexor and GetConnection methods defined. We understand that this is a much bigger change and we will be happy to do it ourselves but it might take a couple more months to merge this change because of some other work items we have. |
The pool solution might work, but if the data size is large, even with multiple multiplexers, some of the threads with timeout waiting. Recently i used Gzip Compression with the optimal level to solve timeouts.
|
There have been numerous issues opened for this project referencing Timeouts. I have personally had this happen recently when my organization started upgrading to the latest version of SE.Redis. Among others, one of the suggested methods to combat this is to pool ConnectionMultiplexors. There are other things you can do, such as forcing more worker threads to be allocated, however we have had the most success with pooling CMs.
This morning the timeout problem surfaced in a core web app we host and Datadog APM indicates it was centered around EVAL calls coming from this library. So I've created this PR to see what the community thinks.