Active
Project:
Drupal core
Version:
main
Component:
database system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2011 at 11:52 UTC
Updated:
23 Feb 2024 at 10:54 UTC
Jump to comment: Most recent
Comments
Comment #1
ogi commentedI've made a very quick test that consistently shows that there's big gain in enabling persistent connections when PostgreSQL 8.4 is used. Without persistent connections (default),
ab -n 1000 -c 10shows 75 requests/sec, with persistent connections enabled it shows 90 requests/sec. Even if it's only for PostgreSQL, it's a pretty significant boost made by one-line change.Comment #2
ogi commentedUnfortunately Drupal uses
PDO::ATTR_STATEMENT_CLASSthat cannot be used with persistent connections :-(Comment #3
ogi commentedComment #4
pwaterz commentedActually this is possible
This is how you would do it.
Include this class in your settings.php.
Then in your settings.php
I have not tested this, but in theory it should work
Comment #5
jackbravo commentedAnd this seemed to be a duplicate of #843114: DatabaseConnection::__construct() and DatabaseConnection_mysql::__construct() leaks $this (Too many connections)
Comment #6
colanI'd recommend that folks read What are the disadvantages of using persistent connection in PDO? before attempting this.
What Drupal does should be good enough, as it maintains the same connection for each page request. I wrote a bit more about this over at Connection Pool.
Comment #7
chi commentedThese two statements contradicts each other.
PostreSQL connection is relatively slow especially when SSL is enabled (that's done by default in many distributions). When page cache is enabled it may happened that ~80% of request time for anonymous visitors is spent on establishing DB connection.
I think it worth reopening.