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

Too many Redis connections: ERR max number of clients reached on Heroku's free tier #104

Closed
albertkim opened this issue May 6, 2019 · 5 comments · Fixed by #433
Closed

Comments

@albertkim
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when

I use Heroku for Cube.js deployments. If I make 3+ concurrent queries to the server, the app instance will crash with the error ERR max number of clients reached. Heroku's free tier allows for 20 connections at once.

Describe the solution you'd like

As mentioned by Pavel on the Cube.js Slack channel, a connection poll would probably solve this issue to prevent Cube from using more than is available.

Describe alternatives you've considered

The only alternative I can think of is to pay more for Heroku. I've had to go up to Premium 2 to not crash, but I'm worried about what happens when more users are generating reports at the same time.

Additional context
Add any other context or screenshots about the feature request here.

@paveltiunov
Copy link
Member

@albertkim Hey Albert! Thanks for posting this. So sounds like it's Redis connections not database ones?

@albertkim
Copy link
Author

@paveltiunov correct.

@paveltiunov paveltiunov changed the title Database connection pools Too many Redis connections: ERR max number of clients reached on Heroku's free tier May 6, 2019
@paveltiunov
Copy link
Member

paveltiunov commented May 6, 2019

So the solution is to create redis connection pool here or just reuse non-blocking redis connections. Total count of Redis connections is equal to count of waiting concurrent users + some constant connections count used to retrieve cache. Redis itself is capable of handling thousands of concurrent connections. For Heroku it's merely a pay wall. You can consider using Redis services without connection limit like https://www.compose.com/pricing#redis.

If there's only single instance of Cube.js server then you can consider running Cube.js without Redis at all: https://cube.dev/docs/deployment#production-mode-running-without-redis

paveltiunov pushed a commit that referenced this issue Feb 27, 2020
* Pool redis connections

* Drain pool after test completion

* Increase pool size, decrease idle timeout

* Install jest instead of mocha

* Convert tests from mocha to jest

* Fix resource leak in fallback mode

* Fix matcher conversion

Fixes #104
@0x62
Copy link

0x62 commented Mar 22, 2020

Getting this issue with the latest version. Looks like Redis polling has been merged, has it made it to live release yet?

@paveltiunov
Copy link
Member

@0x62 Hey Ben! Yep. It's live. However by default there're 1000 max connections for backward compatibility. Please see: https://cube.dev/docs/deployment#production-mode-redis-pool

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 a pull request may close this issue.

3 participants