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

refactor to allow for a connection pool #113

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

refactor to allow for a connection pool #113

wants to merge 1 commit into from

Conversation

wjdavis5
Copy link

@wjdavis5 wjdavis5 commented Jan 25, 2019

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.

@oruchreis
Copy link

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.

@oruchreis
Copy link

By the way our implementation is here: oruchreis/Nuve.DataStore@f9f211c#diff-9707258d90a3ac3b9214ba0f21929797R18
We are not using fixed pool size, and creating a new connectionmultiplexer if we got connection problems like Timeout, SocketFailure, SocketClosed which can occur in a load balanced environments. If an operation throws these exceptions, we dequeue and dispose this connection, and then create and enqueue a new connection.

@wjdavis5
Copy link
Author

wjdavis5 commented Apr 9, 2019

Hey @oruchreis - I have not created a nuget for this.

@davidfowl
Copy link
Member

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.

@aravindyeduvaka
Copy link

@wjdavis5, sorry about the delay but our team has been pretty busy.
We like the idea of using a Connection Pool and allowing users to specify the pool size. However, we would like for some of the design to be different.

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.
If you need it faster, we will happy to accept a PR that addresses these problems.

@marafiq
Copy link

marafiq commented Aug 16, 2019

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.
Perhaps, what options we have .Net Standard to replace this default serialization to something more efficient and which produce smaller size.

@stanleysmall-microsoft stanleysmall-microsoft changed the base branch from master to main May 11, 2022 20:34
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

Successfully merging this pull request may close these issues.

5 participants