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条回答

    报告相同问题?

    悬赏问题

    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式
    • ¥30 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大