-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
数据库连接数过多 #6732
Comments
Hyperf的不同的Worker是用的不同的链接池。你的实际链接池上限是你的[节点数Worker配置数max_connections],确认一下你得出来的是多少。其次看你的数据库连接池使用方法,又没有做release操作。最后看你的mysql设置,idle_timeout时间是多少。 |
我认为是因为开启了子协程 并且没有限制并发的原因导致的。
有两个思路
|
节点数Worker配置数max_connections = 10000, 数据库链接用的是官方提供的组件,还需要自己操作release? |
开启10个我试过, 但并没有关闭子协程, 有写代码是有好几个子协程的. |
不是自己操作,意思就是你看着自己接管链接池的get与release,目前3.1版本都是直到当前Coroutine结束才release。你是实际应用最大连接数是 Node ✖️ Workders ✖️ config.database.max_connections 如果大于你数据库设置就会出现 to many connections。 |
我每个数据可查询都有用上 wait , 根据这个https://chat.swoole.com/#/chat?uuid=04b5aca5-9a55-45a1-8463-999836c49d55 意思是会释放的 |
开启5个数据库, 每个库 min_connections => 10, max_connections => 100
使用http服务时,没有问题,
但是使用nats监听时, 过一会就会出现 Too many connections
The text was updated successfully, but these errors were encountered: