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

Problems with Too Many Connections to Redis #45

Closed
luizeof opened this issue Jul 3, 2023 · 0 comments
Closed

Problems with Too Many Connections to Redis #45

luizeof opened this issue Jul 3, 2023 · 0 comments

Comments

@luizeof
Copy link

luizeof commented Jul 3, 2023

Hello @jrCleber, I found a scenario I wanted to share with you:

In April, Redis released version 7, which has a persistent session as one of its new features, that is, if there is no explicit timeout on the client or configured on the server, the connection remains open forever. By default Redis 7 is configured like this.

From the Redis Documentation:

By default recent versions of Redis don't close the connection with the client if the client is idle for many seconds: the connection will remain open forever.

https://redis.io/docs/reference/clients/#client-timeouts

Those who are still using Redis 6 can also enable persistent connections but the default is that connections are closed after a while.

Looking at the way CodeChat manages connections with Redis, with each new instance of the Redis class a new connection is created and is not closed afterwards, which causes a huge number of connection polls.

In the image below I have a CodeChat installation in a Managed Redis in Digital Ocean with 1 session started lasting 21 minutes and already has more than 3600 open connections in redis:

Captura de Tela 2023-07-02 às 15 27 37 - cópia

Redis has a default setting of 10000 concurrent connections, a simple installation on a number with little use managed to get 3600. I believe that a slightly busy session reaches this limit quickly. (Redis Max Clients)

With around 1000 connections it was enough for CodeChat to start receiving connection denials from Redis, causing a crash.

Redis is a very popular distributed database, and I believe it's essential to keep it working with Codechat, but with an implementation that doesn't require as many connections (or just do the disconnects).

I think it's a start to a discussion of how Redis can be used with Codechat.

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