负载下 PHP 与 MySQL(单独的盒子)的通信中断

发布于 2024-11-25 00:02:47 字数 421 浏览 1 评论 0原文

今天,我们网站的用户数量有所增加(大约是正常负载的两倍),并且我们的系统速度开始变慢。我们的 MySQL 位于它自己的物理盒子上,我们已经开始在日志中收到这些错误;

[2011 年 7 月 18 日星期一 15:30:07] [错误] [客户端 2.221.255.55] PHP 警告:mysql_select_db() [function.mysql- select-db]: 无法在 /home/livesite/_util.inc 第 301 行建立到服务器的链接, referer:

MySQL 盒子很好,并且对我们的开发服务器的响应非常愉快,但是我们的实时服务器在负载增加时看到了此错误消息。

有谁知道为什么 PHP 会停止与另一个机器上的 MySQL 通信?

Our website today received an increase in users (about double our normal load) and our system has started to slow down. Our MySQL sits on it's own physical box, and we've started receiving these errors in our logs;

[Mon Jul 18 15:30:07 2011] [error] [client 2.221.255.55] PHP Warning: mysql_select_db() [<a href='function.mysql-select-db'>function.mysql-select-db</a>]: A link to the server could not be established in /home/livesite/_util.inc on line 301, referer:

The MySQL box is fine, and responds quite happily to our development server, but our live server, as of this load increase, is seeing this error message.

Does anybody know why PHP would just stop communication with MySQL on another box?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光清浅 2024-12-02 00:02:47

您的连接限制可能太低。通常你会得到一个不同的错误,但如果这是问题所在,我不会感到惊讶:

http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

我怀疑第301行正在调用某些函数,例如mysql_real_escape_string(),它解释了错误。连接时可能存在不同的错误,例如“连接过多”,但如果您的连接行前面有一个 @ ,则该错误不会出现在您的日志中。

Your connection limit is likely too low. Usually you get a different error, but I wouldn't be surprised if this were the problem:

http://dev.mysql.com/doc/refman/5.5/en/too-many-connections.html

I suspect that line 301 is calling some function, such as mysql_real_escape_string(), which explains the error. There is probably a different error on connect, such as "too many connections", but that won't be in your logs if your connect line has an @ in front of it.

2024-12-02 00:02:47

也许您应该查看 PHP INI 文件中的 mysqli.max_persistent 之类的内容?
也许你的逻辑连接没有断开 - 足够快?

Maybe you shuold look at your PHP INI file for mysqli.max_persistent and the like ?
Maybe your logic connects without disconnecting - fast enough ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文