The problem is that due to high number of connections sometimes, especially when there are more than 4000 users online, this message appears: ‘Can't connect to MySQL server on '192.168.1.1' (99)
Posted by: Андрей Великанов
Date: December 09, 2015 03:04PM

Good evening! We’ve got a high-loaded project, which is separated into two servers.
The first server (centos 6): 8 core 3400MHZ. 32 gig memory.
The first server has PHP scripts of the web site, css, js, etc.
Build: PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with XCache v3.2.0, Copyright (c) 2005-2014, by mOo
with XCache Cacher v3.2.0, Copyright (c) 2005-2014, by mOo
nginx version: nginx/1.8.0

PHP is built as php-fpm.

The second server (debian 7): 12 core 3800MHZ. 64 gig memory.
MySQL 5.5.46 is used on the second server.

Both servers operate on one network switch, they are connected to the same network.

By means of the first server, we connect to MySQL using the internal IP address 192.168.1.1
The connect to the database is done with mysql_connect

CMS of the web site is built so that in the upper part the connection opens require_once './config.php';
In the lower part – closes mysql_close($con);

The problem is that due to high number of connections sometimes, especially when there are more than 4000 users online, this message appears: ‘Can't connect to MySQL server on '192.168.1.1' (99)’
When there are 4000-5500 users online at the same time, there is no load to both servers http://nice-bux.ru/prisp.jpg

At this time, the problem can be solved by a shift to permanent connections mysql_pconnect(),
But we cannot connect to the MySQL database by means of mysql_pconnect() because our PHP is built as php-fpm, and it is not an apache module.
All the slow queries have been traced with long_query_time, and then they have been optimized.
Now, MySQL database handles ~4000 queries per second. It is ~360000000 queries per 24 hours.

Since we have a large number of the connections with MySQL, do we need to form a queue to MySQL connections in our case? Enlargement of back_log does not help here.
How can be form a queue to MySQL database connection so that the connections don’t fall off and don’t return ‘Can't connect to MySQL server on '192.168.1.1' (99)’ but wait for their turn?
All the MySQL parameters are listed below: http://nice-bux.ru/txt.txt

Options: ReplyQuote


Subject
Written By
Posted
The problem is that due to high number of connections sometimes, especially when there are more than 4000 users online, this message appears: ‘Can't connect to MySQL server on '192.168.1.1' (99)
December 09, 2015 03:04PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.