Does Drupal 7 support connection pooling with mysql?

Comments

john_b’s picture

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

tswaters’s picture

Attached node includes the following applies to "Drupal 4.5.x or older, Drupal 4.6.x, Drupal 4.7.x"

Anyone have some updated information about D7 ?

john_b’s picture

It is quite clear that Drupal does not now support persistent connections. The thinking among core developers does not seem be fully explained in the issue queues.
http://drupal.org/node/49836
http://drupal.org/node/1079892

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

colan’s picture

There are problems with using persistent connections with PDO (the DB interface Drupal 7 uses) as described over at What are the disadvantages of using persistent connection in PDO?.

It hardly seems like it would be worth the trouble of having the application manage all of the cases where things could fail.

Drupal does, however, keep a connection open for each Web server process. That is, each time a Drupal page is requested, the same connection is kept open and used repeatedly for subsequent queries within the page request (unless it dies, in which case a new connection is opened). For details, have a look at the code in db_query().

So basically, MySQL's max_connections should be set slightly higher than the number of PHP processes (MaxClients if you're using Apache). See Is db_query() closing connections? for details.