php - MySQL connection gone -


i using cleardb database windows azure based php application. getting intermittent error on mysql connections. have 2000 online customers. , have 30 connections database.

how can scale website , overcome situation?

i taking care of closing connection of times. have prevented server errors this:

try {    $this->_conn = $this->dbh = new pdo('mysql:host=' . db_server . ';dbname='. db_name, db_user, db_pass);    $this->dbh->setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch (pdoexception $e) {    die("couldn't connect database. please try again!"); } 

so, if there no connections left, it'll show appropriate message. but, it's not feasible customer facing websites. how can solve problem?

edit

how can analyse data:

array ( [0] => array     (         [variable_name] => connections         [value] => 505369     )  [1] => array     (         [variable_name] => threads_cached         [value] => 54     )  [2] => array     (         [variable_name] => threads_connected         [value] => 65     )  [3] => array     (         [variable_name] => threads_created         [value] => 1038     )  [4] => array     (         [variable_name] => threads_running         [value] => 4     ) ) 

i got above result after: show status variable_name 'threads_%' or variable_name = 'connections'

per understanding of issue, not easy design scalable database. consider following suggestions:


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -