dongyan1491 2018-08-29 17:02
浏览 140

MySQLi抛出mysqli :: __ construct():( 08004/1040):连接太多

MySQLi error 2 Too many connections is thrown on our Centos server.

I am testing the application by simulating a ton of requests from another external server.

In my application, I am creating the connection only once. And then reusing it by passing $glob_conn as a global variable inside functions.


I've checked and tried some suggestions online:

Setting /proc/sys/net/ipv4/tcp_fin_timeout to 3 (from 60)

Then made the connection persistent:

$glob_conn = new mysqli(p:127.0.0.1, config_mysql_db_user, config_mysql_db_password, 'uni_partner');

As you can see there are not many connections waiting:

# netstat -anlp | grep :3306 | grep TIME_WAIT -wc
2

# netstat -anlp | grep :3306 | grep ESTABLISHED -wc
304

All to no avail. When I introduce a lot of clients, the same error is returned.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 matlab有关常微分方程的问题求解决
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考