0

there's only one client application running queries against a MySQL instance.

After enabling MySQL's general query log (configured to log every query) I noticed that every query starts with a "Connect".

Does this imply connection pooling isn't working?

Thx, Christian.

Edit1:

DB is accessed by PHP application (SugarCRM). It's configured to use persistent connections.

> egrep connections /var/www/html/sugarcrm/config.php
'disable_persistent_connections' => 'false',

> egrep -A7 dbconfigoption /var/www/html/sugarcrm/config.php
'dbconfigoption' =>
array (
'persistent' => true,
'autofree' => false,
'debug' => 0,
'ssl' => false,
'collation' => 'utf8_general_ci',
),

Main Question (not trying to solve it at the moment, just want to understand): If in the log every query starts with a "Connect" - does this then imply that no persistent connections are used?

0

1 Answer 1

1

Three aspects must be considered

ASPECT #1 : PHP

PHP has a setting for Persistent Connections

[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent=On

Make sure this is on in php.ini if you want to use Persistent Connections

ASPECT #2 : Your Code

Since mysql_pconnect is deprecated, make sure you are using one of the following

ASPECT #3 : MySQL

When mysqld sees a connection attempt, it records it statistically as one of the following

If the general log is echoing just the word Connect as an event, chances are that's just a Connection attempt. Any subsequent events on that connection would be operating on a established thread (DB Connection). The general log will not tell you whether the DB Connection is newly created or already established.

To actually know if the connections are coming and going, you should monitor

To actually see them in a single query, please run this

SELECT * FROM information_schema.global_status WHERE variable_name IN
('Connections','Aborted_connects','Threads_connected','Threads_created');
2
  • What should be done to ensure resources are released when the processing is completed for this active connection? Commented Jul 27, 2019 at 11:45
  • @WilsonHauck See my old post "Why decrease the wait_timeout configuration parameter in MySQL?" dba.stackexchange.com/questions/41585/… Commented Jul 27, 2019 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.